A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: help with code.

  1. #1
    Senior Member
    Join Date
    Aug 2003
    Location
    ohio
    Posts
    142

    help with code.

    Hello everyone,

    I am using the following code (using flash MX) on frame 17 of my movie. The first 16 frames of my movie is a short animation. On frame 17, I have a stop(); and then the code below to load another movie clip (the "pSamples" movie clip is the main page content). The movie clip is exported for actionscript and for exported in the first frame. I am loading it to a specific x and y location. I am not sure why, but it isn't loading the movie clip as it gets to frame 17. I know it is getting to frame 17 because the animation finishes and everything shows up except the movie clip. I have checked the obvious like making sure I am referencing the correct movie clip. I did take out the stop(); action to see if that was it and it didn't make a difference. I did put a trace statement in the code to see if I could do a type of reference on the movie clip reference name (pSamples) and it didn't display anything.....any suggestions? What I am trying to accomplish is to have a section on my movie where I can load and remove movieclips for the different topics in my movie. Thanks.


    code:
    this.onEnterFrame = function(){
    attachMovie("pSamples", "pSamples_mc", 10);
    pSamples_mc._x = 425;
    pSamples_mc._y = 175;
    }

    wd
    Last edited by wdperson; 08-21-2003 at 08:02 AM.

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Posts
    202
    I think doing it on enterFrame means you are always starting the loading sequence.

    Try calling it once. Put this code on frame 17 (substitute [yourMCname] with the name of the mc):

    code:

    [yourMCname].loadMyMovie = function(){
    this.attachMovie("pSamples", "pSamples_mc", 10);
    this.pSamples_mc._x = 425;
    this.pSamples_mc._y = 175;
    }
    // call it once
    [yourMCname].loadMyMovie();

    // stop
    stop();


  3. #3
    Senior Member
    Join Date
    Aug 2003
    Location
    ohio
    Posts
    142
    lochwinnoch,

    Thanks. That makes sense now that I think of it. onEnterFrame runs constantly as I recall. Thus it is probably just keeps looping at the beginning? Just my thoughts. I will try that and see what happens.

    thanks again.
    wd

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center