A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: dynamically creating instance name of movie clip

  1. #1
    Member
    Join Date
    Aug 2000
    Posts
    69

    dynamically creating instance name of movie clip

    Hi everyone

    a shove inthe right direction very much needed.

    I have a movie clip (Lets call it mc01.swf) that I am loadin on my main movie.
    this movioe clip is loaded inside an empty container in my main movie. the contaner mc han instant name "contmc"

    I want to stop the loaded Mc i.e mc01.swf whcih is loading inside the empty container.

    any idea how i can target the time line of teh loaded movieclip??

    thanks for your help

    P.S. im using flash MX
    faith_love_hope
    www.surfunion.com

  2. #2
    FK Supermodel laxmi19885's Avatar
    Join Date
    Jul 2001
    Location
    Mumbai
    Posts
    474
    contaner.contmc.stop();

  3. #3
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    _root.contmc.stop();

  4. #4
    Member
    Join Date
    Aug 2000
    Posts
    69

    :(

    i did that it does not work
    faith_love_hope
    www.surfunion.com

  5. #5
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    If it didn't work then there may be a problem in the spelling of the paths.
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  6. #6
    Member
    Join Date
    Aug 2000
    Posts
    69

    it worked

    Okie thisis crazy!!

    and for some reason now i'm totaly dazed and confused

    The path is correct this is what I did

    In the empty container mc i.e. "contmc" on the first frame i gave the load movie script and targeted "contmc"

    now "contmc" is on the main time line.

    on the main time line i gave the following script

    _root.contmc.Stop();

    I gave this on the 70th frame (becasue the loaded movie is 50 frames long and I am loding it on the 20th frame of the main time line)

    AND THIS WORKED.

    Initially this script
    _root.contmc.Stop();
    was inside the "contmc' movie clip and it didnt work then
    i even tried _root.contmc.this.Stop(); but it didnt work


    any explaination?

    Is tehre a way to give an instance name dynamically to a movie thats being loaded ??

    thanks for your time and help.
    faith_love_hope
    www.surfunion.com

  7. #7
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Thas a good question. I know how to dynamically name MC's already there, but not? Hmm....

    But as for your problem, that's strange. Dunno why it wouldn't work.
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    stop(); or this.stop(); alone (and not Stop();) would of done it on the last frame of the movie clip!

  9. #9
    Member
    Join Date
    Aug 2000
    Posts
    69
    hi Steve, thanks for your reply

    you mean u know how to dynamically name a MC thats already there but not a MC thats being loaded??

    hi OldNewbie
    Thanks for your reply

    Well i did give a stop(); onthe last frame of the "contmc"

    it didnt work either

    the problem is that I am loading an swf thats generated in 3dmax and exported as a swf file. so i cant put a stop action in the swf that i am loading


    I just wanted to know how come its working if the stop action is given outside the empty container and that same code does not work when targeted from witin the container movie clip.

    im sure thre is some logic that my lil brain cannot make out
    faith_love_hope
    www.surfunion.com

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    When you load an external movie in a container clip, the container clip's content is replaced by the loaded movie, and that movie is now referred to with the container's instance name.
    That's why it works when using _root.contmc.stop(); (no capital S), because your stopping whatever is in the container clip, which is now your loaded movie.

    But you could also have another empty control clip that would constantly monitor the "contmc" clip's current frame and stop it whenever you wanted.

    As for dynamic naming and creating a movie clip...
    You can create a dynamic movie clip at runtime, and give it whatever name you want to give it. Without having tested it (because I don't really see the point), don't see why you couldn't pull in an instance name variable from a text file and use that variable when creating your dynamic movie clip. Just don't see the point!
    Last edited by oldnewbie; 11-14-2003 at 01:32 AM.

  11. #11
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Originally posted by flash_kid76
    hi Steve, thanks for your reply
    ...
    you mean u know how to dynamically name a MC thats already there but not a MC thats being loaded??

    Yea. Simple:
    code:
    this._name="myClip";


    Does this apply to all content being loaded into it? Will commands such as gotoAnd_____ and stop() and play() and all the frame controlling scripts work? Seems like they would/should.
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  12. #12
    Member
    Join Date
    Aug 2000
    Posts
    69
    Originally posted by oldnewbie
    When you load an external movie in a container clip, the container clip's content is replaced by the loaded movie, and that movie is now referred to with the container's instance name.
    That's why it works when using _root.contmc.stop(); (no capital S), because your stopping whatever is in the container clip, which is now your loaded movie.
    my query is that the srcipt works when put outside the MC and it doesnt work if its put inside the "Contmc"

    So is it becasue u cant control the timeline using
    _root.contmc.stop();
    if used inside the contmc?

    QUOTE]Originally posted by oldnewbie
    As for dynamic naming and creating a movie clip...
    You can create a dynamic movie clip at runtime, and give it whatever name you want to give it. Without having tested it (because I don't really see the point), don't see why you couldn't pull in an instance name variable from a text file and use that variable when creating your dynamic movie clip. Just don't see the point!
    [/QUOTE]

    im sorry, but I really dont understand this
    im not much of a coder.

    Thanks for your time and help
    faith_love_hope
    www.surfunion.com

  13. #13
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    What I'm saying is that whatever you originally put in the "contmc" movie clip, graphics, images and CODE, is lost when you load a new external movie in this clip, and replaced by the content of the new loaded movie. Only the instance's name remains the same. That's why if you put _root.contmc.stop(); in the "contmc" but then load another movie into it, that code is lost.

    If the new loaded movie, had a button with that code within itself though, then it would work.

  14. #14
    Member
    Join Date
    Aug 2000
    Posts
    69
    hey thanks Old newbie,
    i figutred that out over the week end but was not too sure about it.
    your explaination confirmed that my thought were inthe right direction :-)

    Once again thanks for your time and help everyone
    faith_love_hope
    www.surfunion.com

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