SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with MovieClips in Flash/ActionScript

    I would like to know if someone could help me out on how I could use movie clips in Flash/ActionScript.

    The problem is this: the flash size is just too heavy because I can't load more than one image dynamically into my movie clips during runtime.

    Secondly, I can't load my movie clips sequentially (that is, one after another), all the movie clips seem to load at the same time and I don't want that to happen. Thanks.

  2. #2
    SitePoint Wizard jim_morrison3's Avatar
    Join Date
    Apr 2004
    Location
    UK
    Posts
    2,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is this: the flash size is just too heavy because I can't load more than one image dynamically into my movie clips during runtime.

    Secondly, I can't load my movie clips sequentially (that is, one after another), all the movie clips seem to load at the same time and I don't want that to happen.
    The solution to both your problems is that you need to have a repository like an array and make a counter and two functions, one function will load the images and call the 2nd function when the image loads completely, the 2nd function increments the counter and calls the 1st function. Something like the following:

    Code:
    var ctr:Number=0;
    var myArr:Array=["1.jpg","2.jpg","3.jpg"];
    var mcLoader:MovieClipLoader=new MovieClipLoader();
    var listener:Object=new Object();
    
    function loadImage(){
    listener.onLoadInit(){
    incrementCounter();
    }
    
    mcLoader.addEventListener(listener);
    mcLoader.loadClip(myArr[ctr],myMc);
    }
    
    function incrementCounter(){
    ctr++;
    loadImage();
    }
    Good Luck!
    There are things known and Things unknown
    And in between are the Doors.
    I love hand Coding.

  3. #3
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much for that reply, however how do I position the images on their respective positions, and apply the following function:

    function MoveTo(clip, fadeType, xTo, yTo, speed)
    {
    clip.onEnterFrame = function ()
    {
    this._x += (xTo - this._x) * speed;
    this._y += (yTo - this._y) * speed;
    if(fadeType == "in" && this._alpha < 100)
    {
    this._alpha += 5;
    }
    else if(fadeType == "out" && this._alpha > 0)
    {
    this._alpha -= 5;
    }
    }
    }


    so that the images slide into their various positions sequentially (one at a time) 'cos whenever I use the above function they all slide in at the same time.

  4. #4
    SitePoint Wizard jim_morrison3's Avatar
    Join Date
    Apr 2004
    Location
    UK
    Posts
    2,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can call your MoveTo() method inside the onLoadInit() method.
    Good Luck!
    There are things known and Things unknown
    And in between are the Doors.
    I love hand Coding.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •