A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Button that loads MC

  1. #1

    Button that loads MC

    ok heres the deal i want to have a MC load/play when i click on the button..right now i dont have a MC but i just have my button tell the scene to goto a certain frame which is fine(is guess) but the problem is i now have over 200 frames now, i think i could greatly reduce this by moving the actions to a MC and then have my button call the MC that is approprate...

    heres the file, so you can maybe understand what im looking for (its under bio)
    rider for life

  2. #2
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Take the mc out of the timeline and leave it in the library. Right click it's name in the library and chose Linkage from the popup. In the new popup, check Export for actionscripting and export in first frame and give it a name, like clip1.

    Then on the button:

    on(release){
    attachMovie("clip1", "clip1", 1);
    }

    If you want the clip to be positioned somewhere on the stage, open the clip and in the first frame, add this:

    this._x = 50;
    this._y = 50;

    That puts the top left corner of the clip at x, y 50 on the main stage, when it loads. Set the numbers where you want.

  3. #3
    ok i got that part almost..the mc wont move nomatter where i set this._x and _y at...also when its done running i want it to beable to go back to scene 1 frame 1 by a click of a button and make the mc not show up
    rider for life

  4. #4
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    this._x = 50;
    this._y = 50;


    This goes inside the movie clip, on the first frame of the timeline, in an actions layer, above any other code. If it's not working to position the movie clip on the stage, you have something wrong.

    To go back to scn 1 frame 1, put a frame lavel there named scn1fr1. Then on a button:

    on(release){
    _root.gotoAndStop("scn1fr1");
    removeMovieClip("clip1");
    }

  5. #5
    ok thanks i will try that
    rider for life

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