A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: button in MC load swf in main timeline

  1. #1
    otto
    Join Date
    Jul 2009
    Posts
    13

    button in MC load swf in main timeline

    Dear all,

    I've a problem about AS2 on button within a MC.

    In my working flash, there are 2 MCs

    1. a MC called content, full size as the movie, act as a blank platform to load external swf
    2. another MC button containing a button, click to loadMovie, placed on top of MC content

    I'd like to click the button in button to load an external swf in content.

    The script I added on button in MC2
    Code:
    on(release){
    	loadMovie("XXX.swf", this.content);
    }
    This only work when the button is in the main timeline.

    I also tried
    Code:
    on(release){
    	_parent.loadMovie("XXX.swf", this.content);
    }
    Code:
    on(release){
    	_root.loadMovie("XXX.swf", this.content);
    }
    This will load the swf, but replacing everything. i.e., MC button disappeared with only the external swf playing.

    Would someone please help this issue?

    Many thanks,
    otto
    Last edited by ottoman0423; 07-30-2010 at 11:17 AM.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    it's not this content anymore, since content seems to be on the main timeline.

    gparis

  3. #3
    otto
    Join Date
    Jul 2009
    Posts
    13
    yes, MC called content is placed in the main timeline.

    I've just tried the following

    Code:
    on(release){
    	_root.loadMovie("XXX.swf", content);
    }
    Code:
    on(release){
    	_parent.loadMovie("profile.swf", "content");
    }
    also not succeed.
    The external swf replace everything instead of loading within MC content

    Would you please suggest?
    Last edited by ottoman0423; 07-30-2010 at 11:43 AM.

  4. #4
    otto
    Join Date
    Jul 2009
    Posts
    13
    My working flash is as attached.
    Your help is very much appreciated.

    Thanks,
    otto
    Attached Files Attached Files

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    The right syntax is:

    loadMovie("XXX.swf", _parent.content);

    or

    _parent.content.loadMovie("XXX.swf");

    read about loadMovie() in the liveDocs (link in my footer) or in your help files.

    gparis

  6. #6
    otto
    Join Date
    Jul 2009
    Posts
    13
    It works!!

    MANY MANY THANKS!!

    you are my HERO

  7. #7
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    IMHO...your problem stems from putting CODE on the actual 'button' inside the movieClip..

    you should out 'all' code in the MAIN timeline.. on the FRAME.. not on any objects/movieClips.


    when you put code ON an object.movieClip.. you need to be VERY clear and understand what your scope is so you can path to other variables/data & code..

    when you place code ON an object.. and use of THIS means the object that has the code poasted to it..

    so you needed to navigate form that time line to the MAIN (_parent) time line to find your CONTENT movieClip.. and load your contents there..

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