Keeping "state" with many movie clips

In one frame (Frame A), I've dynamically attached many movie
clips for a tile-based game. This happens in the init function of
that frame. If I move to another frame (Frame B) temporarily (to
display something else), it looks like I need to remove or unload
all of the movie clips so that they don't show up on Frame B. Is
that the only way to not have them show? The problem is that when I
return to Frame A, I would like it to have the same state
(positions of objects, etc.) as when I left it. What is the best
way to accomplish this?
As an alternative, I suppose I could draw something on top of
the screen (higher z order) and mask what is below and then remove
what was draw on top when I'm finished with it. I would prefer to
figure out a way to accomplish it the first way, though, because I
can use this for other things as well.
Does anyone have any advice on this?
Thanks!

I understand that you can remove one parent instead of many
children in this way, which is good from an efficiency standpoint.
Beyond that, I was ideally looking for a way to basically "freeze"
the action on Frame A and return to it. I assume that, even with a
parent-child scenario, I would still need to loop through all of
the children and save their states (because just checking the
parent attributes isn't going to get at this information). I was
just asking if there was any easier way. It would be nice to be
able to go to another frame - maybe on another level - and then
come back to Frame A and pick up where I left off - just hopeful
thinking, I guess.

Similar Messages

  • Can i assign a child state to a movie clip that is already placed on stage

    Hello
    Is it possible to add a child state to a movie clip that is
    already placed on stage,
    i need to do this so i can move the movieclip to the top of
    the display list.
    thanks for the help
    mt

    "The objects i want it to appear above are loaded swf's onto
    the same main stage."
    Aha, this is where things can get confusing. The terminology
    between the Flash Authoring tool and ActionScript is not
    consistent.
    In ActionScript, the Stage is the top most DisplayObject. You
    probably get that.
    In Flash, the canvas that is often referred to as "the stage"
    is not the Stage object of ActionScript, rather the Flash stage is
    a DisplayObject class called MainTimeline (or if you assign a
    document class, it's that class), which is the first and only child
    of the ActionScript Stage object. It's the only child unless, of
    course, you add something else to the ActionScript Stage object at
    runtime... like a loaded swf. ;)
    So in other words, if you are doing anything like this:
    stage.addChild(myLoadedSWF)
    You are actually putting myLoadedSWF above the MainTimeline
    object, which is the entire Flash timeline. There's nothing wrong
    with that, but in this case it means changing the depth of things
    inside the MainTimeline is not going to change the fact that the
    MainTimeline itself is below myLoadedSWF.
    Most likely the simplest solution is to add your loaded SWFs
    to the property "root", not stage. root can refer to different
    things in different places, but most of the time it refers to the
    MainTimeline, and if I had to guess I would say it almost certainly
    does in your case. Note that the "root" property is typed as a
    DisplayObject, not a DisplayObjectContainer, so addChild (which is
    a DisplayObjectContainer method) will not be recognized unless you
    typecast to DisplayObjectContainer or a subclass of
    DisplayObjectContainer, like Sprite or MovieClip:
    MovieClip(root).addChild(myLoadedSWF)
    Also note that, unlike AS2, in AS3 it's very easy to simply
    add your loaded SWF below existing objects you create in Flash. You
    can use addChildAt(obj,0) for instance to add it to the very
    bottom.

  • Working with an Movie Clip as a button.

    I am creating a button with a 20 frame disolve into a page upon entry.  I want the button to play a 20 frame disolve back to it's original state when the user rolls out.  I want the movie clip to play from frame 21 to the end of the mc and then become inactive.  I can get the button to disolve out but the user will not be able to use it after that first roll over.  I was thinking of trying to add a time delay from when the first action of the rollout occurs to when the disolve is complete.  How do I include a 20 frame delay in the roll out sequence?
    Here is my code so far:
    //Index Button
    mc_buttons.mc_index.onRollOver = function ()
        this.active = 1;
    mc_buttons.mc_index.onRollOut = function ()
        this.gotoAndPlay (21);
    //This is were I might include the time delay.  Any suggestions?
        this.active = 0;
    mc_buttons.mc_index.onEnterFrame = function ()
        if (this.active == 1 && this._currentframe == 1)
                this.gotoAndPlay (2);
            }else if (this.active == 1){
            }else{
            this.gotoAndStop (1);
    mc_buttons.mc_index.onPress = function ()
        getURL ('#');

    The clip has a stop action at frame 1.  On rollover I want it to play at frame 2 until it hits the next stop action command at frame 20.  On roll out I want the clip to play at frame 21 and continue to the last frame (40) then loop back to frame one and stop.
    So that the user can go back to the button after the first time I want the link to become inactive.  The frame rate is 32 fps so I only need a one second delay from the this.gotoAndPlay (21) command to the point where the link is de-activated, this.active = 0;, so that it can be activated again, this.active = 1;.
    I found a line of code on another forum, setInterval(nextThing, 1000);, but it didn't work.
    Any Thoughts?
    Thanks

  • Need help with using Movie Clips

    I know how to create a MovieClip object, add it to the main
    stage and even add things to the movie clip but how do I create
    frames within that movie clip that I can "gotoAndStop" or
    "gotoAndPlay" with?

    Ok, I know replying to my own post is odd on some forums, but
    anyhow:
    I've done some further testing and find that FlashObject
    isn't the problem.
    Looking at the AS code above, it is clear that the SWFs to be
    loaded must be in the same folder as the HTML web-page.
    However, my intent is that these small SWFs that are being
    loaded in by the main SWF will be shared by many other movies,
    therefore I'd like to stick them (the physical SWF files) closer to
    the root of the site (e.g. SiteFoler->flash).
    I see that my problem rears its ugly head when I try to
    reference these movies in my main flash movie as follows:
    First movie:
    this.createEmptyMovieClip("mcToolbar", 10);
    with (mcToolbar)
    _x=8;
    _y=68;
    loadMovie("../../../flash/toolbar.swf",mcToolbar);
    Second movie:
    this.createEmptyMovieClip("mcWindow", 11);
    with (mcToolbar)
    _x=500;
    _y=60;
    loadMovie("../../../flash/textwindow.swf",mcWindow);
    In the example above, my HTML page is 3 folders deep whereas
    the movies I'm loading in are 1 folder deep in the folder labeled
    "flash".
    By doing it in this manner, I get the problems I described
    above (first movie loads then disappears and second movie loads in
    wrong position).
    Any ideas as to why the physical location of the SWFs being
    pulled in is causing this problem? I'd like to try to avoid copying
    the SWFs to each place their being refrenced from as that could be
    a major maintenance headace.
    Thanks,
    Ben

  • Buttons with nested movies clips...

    Hi guys
    I'm a flash newb. Have just read some tutorials on creating
    flash buttons that contain nested movie clips for the different
    states. So I went and made 5 of them for my site, all seems great
    the rollover effects are just as planned, and I thought I could add
    URL link to them in Dreamweaver but thats not working out. Been
    googling my *** off to add URL via actionscript (of which I
    understand VERY little) , found some code (add the following to key
    frame :on(release) {
    getURL('
    http://www.generic.com',
    '_parent');
    Major problem is, when I try to add AS to the frame/button,
    I'm getting told I 'current selection cannot have actions applied
    to it' If I persist and add the script anyway, funnily enough it
    doesn't work.
    I did an experimental button, consisting of diff coloured
    boxes, and AS will apply to that no problem.
    I'm tearing my hair out, as I already posted the flash links
    on my site and have had to add a note for visitors to use static
    links in the interim.
    I would love to post the .fla file but I don't see an option
    anywhere here to do so.
    If some wise soul can help my dumb *** out of this bind it
    would be greatly appreciated.

    You were using AS2 code, which will not work in AS3. That
    particular code is placed on an object, which AS3 does not allow
    for, which is why it wouldn't let you... all code in AS3 goes into
    timeline frames.
    For mouse interctive objects (buttons, movieclips, etc) you
    assign event listeners to the object. Let's say your button has an
    instance name of "btn", here's a variety of the possible event
    listeners avaiable, and I've assigned them to the button....
    btn.addEventListener(MouseEvent.CLICK, clickHandler);
    btn.addEventListener(MouseEvent.DOUBLE_CLICK,
    doubleClickHandler);
    btn.addEventListener(MouseEvent.MOUSE_DOWN,
    mouseDownHandler);
    btn.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
    btn.addEventListener(MouseEvent.MOUSE_OVER,
    mouseOverHandler);
    btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    btn.addEventListener(MouseEvent.MOUSE_WHEEL,
    mouseWheelHandler);
    All of those "...Handler" things at the end are the names of
    functions you create to take action when the listener hears
    something it's assigned for... you can name them anything you want,
    and here's and example of how the function might look for the CLICK
    event...
    function clickHandler(event:MouseEvent):void {
    trace("clickHandler");
    Again, you can name the function anything you want, and the
    code within the function can be whatever you need done when the
    button is clicked... just be sure to include the argument
    "event:MouseEvent" because the listeners throws an argument to the
    function and the function needs to expect it. The "event" part of
    that is a variable name, so you can name it whatever you like, such
    as "e", which is commonly done. The MouseEvent defines the class,
    and should be exactly what it is.... a MouseEvent, caps and
    all.

  • Help with some movie clips and an function...

    Hi all..
    I`m having trouble with an function used to animate two movie
    clips....
    I want to use the function like this " fSwitch("movie1",
    "movie2"); "
    I`ve checked to see if I had typoes but I don`t and the
    scripting looks good to me...
    In spite of this fact , when I test the code or movie i get
    this erros :
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 32:
    There is no property with the name '_x'.
    sItem2._x = 10;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 33:
    There is no property with the name '_y'.
    sItem2._y = 10;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 34:
    There is no property with the name '_xscale'.
    sItem2._xscale = 10;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 35:
    There is no property with the name '_yscale'.
    sItem2._yscale = 10;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 36:
    There is no property with the name '_alpha'.
    sItem2._alpha = 0;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 37:
    There is no property with the name '_y'.
    while(sItem2._y <= Stage.height/2 -1) {
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 38:
    There is no property with the name '_alpha'.
    if(sItem2._alpha <= 97) {
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 39:
    There is no property with the name '_alpha'.
    sItem2._alpha += 3;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 40:
    There is no property with the name '_alpha'.
    sItem1._alpha -= 3;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 42:
    There is no property with the name '_x'.
    sItem2._x +=2;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 43:
    There is no property with the name '_y'.
    sItem2._y +=1;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 44:
    There is no property with the name '_x'.
    sItem1._x +=2;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 45:
    There is no property with the name '_y'.
    sItem1._y +=1;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 48:
    There is no property with the name '_y'.
    if(sItem2._y >=98) {
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 50:
    There is no property with the name '_xscale'.
    sItem2._xscale +=1;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 51:
    There is no property with the name '_yscale'.
    sItem2._yscale +=1;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 53:
    There is no property with the name '_xscale'.
    if(sItem2._xscale >= 100) {
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 58:
    There is no property with the name '_xscale'.
    sItem1._xscale -=1;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 59:
    There is no property with the name '_yscale'.
    sItem1._yscale -=1;
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 61:
    There is no property with the name '_xscale'.
    if(sItem1._xscale <=10) {
    Total ActionScript Errors: 20 Reported Errors: 20
    Please help me out :-<
    The code :

    sItem2 is a string and strings don't have _x etc properties.
    "movie1" should be a movieclip, not a string when passed to
    fSwitch() and fSwtich parameter typing should be changed. or
    convert "movie1" into a movieclip in fSwitch()
    to remedy the issue with sItem2, use a reference to your
    movieclip created by attachMovie().
    for example:

  • Newbie:  Help with Interactive Movie Clips

    I'm just starting off with Indesign and am already running into an issue on a seemingly simple issue.  I'm trying to create an interactive document that I will play movie clips when exported to pdf.  Ok so far so good.  I've inserted one movie and started to play around.
    1st issue - The only option I can get to actually play the movie when clicked is when the pdf export option for compatibility is set to 'Acrobat 5 (PDF 1.4)'
                     How come no newer options work?  Using Acrobat reader 9 by the way and tried to toggle options such as 'embedding' the movie.
                     No luck with playing on any setting except 'Acrobat 5 (PDF 1.4)'
    2nd Issue - Inside the movie options dialog box for this clip, there is an option for a poster that I can 'choose movie frame' as poster.  The dialog box       comes up and is completely empth with no video controls or anything.  What the deal with this.
    I'm just starting out and I know I'm not totally incompetant but I'm not very pleased with what I'm seeing right now.
    Any help or suggestions would be very much appreciated.
    Thanks,
    Don

    Here is some help for starter.
    For embedding, do that in InDesign. I think you know the movie will only play in the PDF.
    If you export to PDF 1.3/1.4•Non-RGB movie or sound posters aren’t visible in the exported PDF document.
    •SWF and MPEG movies aren’t playable in the exported PDF document.
    •Clipping paths applied to movie or sound posters don’t appear in the exported PDF document. Posters are resized to match the movie page item.
    •Movies cannot be embedded.•Sounds cannot be linked.
    If you export to PDF 1.5 or laterQuickTime is specified as the preferred player when exporting to PDF. To change the preferred player, you must edit the rendition in Acrobat 6.0 or later.
    If you export to any PDF version•Non-rectangular media frames don’t appear in the exported PDF document.
    •Hyperlinks applied to movies, sounds, or buttons are not active in the exported PDF document. However, you can add those hyperlinks using Acrobat Professional.
    •Rotated or sheared movies and posters may not appear correctly in the exported PDF document.
    •Any masking applied to movie frames or posters is not supported.

  • How to use classes with the Movie Clips

    Hi guys!I have a movie clip called teacher.It's assigned to a class called teacher.It has a location(room).I have multiple rooms and so i want the teacher to be only visible in the room it's at.I have  two buttons for each room.The problem is the teacher doesn't disappear when it's in the playroom.
    package  {
              import flash.display.MovieClip;
              public class teacher extends MovieClip {
                        var room:String;
                        room="classroom";
                        this.croom=croom;
                        public function teacher() {
                                  var teacher:teacher=new teacher();
                        if(teacher.room!==croom){
                                  teacher.visible=false;
                        if (teacher.room==croom){
                                  teacher.visible=true;
    clroom.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
    function fl_MouseClickHandler(event:MouseEvent):void
              croom = "classroom";
              classroom.visible = true;
              playroom.visible = false;
    btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);
    function fl_MouseClickHandler_2(event:MouseEvent):void
              croom = "playroom";
              classroom.visible = false;
              playroom.visible = true;

    Where is all of the code you just showed?
    Only a portion of it is a class file's code, and of that class file's code, only a portion of it is valid.  The paret where you have the conditional checking the treacher's roon is not incorporated proerly... it needs to be inside some function of the class. 

  • Problem with Duplicate Movie Clip which is tracked in an Array

    I have a problem with my inventory code using Shared Objects.
    What i did was to track the collected items in an array. Each time
    the user collects an item, the original iconMC is duplicated and
    loads a picture of the item (function loadImage). However, my
    problem is that this retains the original array so even if I
    already added new items into the inventory, the newest item doesn't
    show. original array length = 2, new array length = 3; the last
    item doesn't show. If I reload my flash, its the only time that
    this shows. Now if I get an item and lessen the inventory, it still
    retains the original length and doubles (or triples, depending on
    how many items i lessened) the last item.
    var so:SharedObject = SharedObject.getLocal("lakbayUser",
    var i:Number = so.data.currentUserIndex;
    var ctr = 0;
    var iconCtr;
    var iconArray: Array; //temporary storage of items placed
    inside icon
    function selectIcon(num){
    eval("iconMC"+num)._alpha = 0;
    so.data.users
    [15][0] = true;
    so.data.users[15][1] = iconArray
    //loads the next icon
    function setNextIconMC(itemCtr, iconCtr){
    if(iconCtr > 0) {
    newName = "iconMC" + iconCtr;
    newPos = 130 * iconCtr;
    _root.itemaHolderMC.iconHolderMC.iconMC0.duplicateMovieClip(newName,iconCtr+1);//does
    not duplcate if unloadMovie is called
    this[newName]._x = newPos;
    this["iconMC"+iconCtr].enabled = true;
    this["iconMC"+iconCtr]._alpha = 100;
    loadMovie("gamit/icon"+itemCtr+".jpg",_root.itemaHolderMC.iconHolderMC[newName]);
    trace(_root.itemaHolderMC.iconHolderMC[newName]);
    else {
    iconMC0.enabled = true;
    iconMC0._alpha = 100;
    loadMovie("gamit/icon"+itemCtr+".jpg",_root.itemaHolderMC.iconHolderMC.iconMC0);
    //loads all the icons into the container
    function loadImage(){
    iconCtr=0;
    iconArray = new Array();
    for(itemCtr = 0; itemCtr < so.data.users
    [14].length; itemCtr++){
    if(so.data.users[14][itemCtr] == true){
    iconArray[iconCtr] = itemCtr;
    setNextIconMC(itemCtr,iconCtr);
    iconCtr++;
    if(iconCtr==0){
    iconMC0._visible = false;
    else iconMC0._visible = true;
    loadImage();
    so.flush();
    stop();

    hey there yenniie - each time you update the array you must
    also call 'flush' to update the SharedObject. also please use the
    'attach code' button to post code, as you can see what happened in
    your post with the ' i ' value. So assuming I'm interpreting the
    the missing characters correctly the method should be:

  • Photos do not appear in imovie 11. black screen with frozen movie clip

    Imovie 11 Photos do not appear in the movie a black screen for picture in picture or a frozen screen with sound and no photo

    Yes
    There is one possibility
    • AVI or .avi is no Video Format/Codec - it is a container and usually contains something iMovie can not use OK.
    Open it with QuickTime-player and then open inspector (cmd+I) and read
    • Video Format/Codec: nnnnnnnnnnnnn
    What does it read ? (all of it)
    from wife Nikon D300s I read
    Yours the same ?
    Either I would
    • import it into iPhoto and in iMovie import from title iPhoto Movies at top in Events window - or
    • convert it into streamingDV .dv or AIC and use this.
    AND - my read 24fps - I would convert this to PAL 25fps or to NTSC 29.97 (if for US) by JES_Deinterlacer.
    Yours Bengt W

  • Acrobat Pro custom stamp keeps duplicating with mouse move

    Using Acrobat X Pro if we add a custom stamp to a PDF document, every time we move the mouse (or onboard pointer) it duplicates the stamp in a new location.  This is new behavior & didn't used to do this.  Anyone ever see this before or know of a fix?

    It sounds like you have the option to keep the stamp tool selected ticked on, which means that after you apply a stamp it will automatically generate a new one. If you want to disable it right-click the tool and untick the "Keep Tool Selected" option.

  • Update statement with many fields

    Hi,
    I am writing an update statement, in a php page, that is formed by many fields, about 80 fields and I would not specify all the fields, does it exist a way to write the update statement without specify all the fields of the record? (I want update all the fields of a record)
    Thanks, bye bye.

    One question here.
    when we give SET col1 = col1 the update will happen right?
    If my update is going to update 100000 rows of column 1 and column 1 also has an index then wont it be expensive to use such logic insted of just ignoring it from the list.
    Thanks,
    Karthick.

  • Recommendations for page with many movies?

    I have created a page with iWeb that has over 20 mini movies on one page.
    They are all small and the whole site (which consists of this one page) is less than 4 MB, but it pretty difficult to scroll through the page (slow moving).
    I'd love to hear some suggestion on how to do what I'm doing in a better way so that scrolling through the page wasn't such a problem.
    Any ideas (or different programs) would be greatly appreciated.
    Luke
    Here's is the page:
    http://www.calhouncycle.com/shopcast/wp-content/uploads/bells/Site/_.html

    Having all of the videos on the page in that manner requries them all to load as the page loads. That's what making the page so slow.
    One method is what I've used in this demo page: PhotoPresenter Animated Slideshow Themes.
    How it's done is described in this demo page: Opening Item in a New, Precisely Sized Window.
    However, both my site and yours require the viewer to have Quicktime installed on their computer. Roddy's iWeb for Musicians site has several pages of video players that work with both PCs and Macs. Some are:
    <a href="http://www.iwebformusicians.com/HTML5-Media-Players/JW-Video-Player.html" JW Longtail Video Player</a>
    Play movies on your website with HTML5 Video
    HTML 5 Web Video
    OT

  • Trouble with playing movie clips

    PLEASE can someone help?
    I have just imported video footage from my old Sony Handycam and all that appears on the event library is single grey squares...clips?   It takes forever for the beachball to stop whizzing - don't understand it.
    It tried to watch previously imported videos and they seem to work ok.

    Also, one of the "events" shows every single frame and is jerky when I ask it to play.

  • Trying to access a specific movie clip with a string

    Ok, what I am trying to do is create as many movie clips as I
    need and then access those movie clips using string values. These
    string values are stored in an array and coincide with a given
    movie clips instance name. Check out the following code:
    I think my problem is that Flash is trying to call movie clip
    methods on a string instance. I'm not sure how to type cast in
    Flash, or even if it is possible, but how would I access the
    strings as movie clips?

    DuhChamp,
    > I think my problem is that Flash is trying to call movie
    > clip methods on a string instance.
    Bingo.
    > I'm not sure how to type cast in Flash, or even if it is
    > possible, but how would I access the strings as movie
    > clips?
    Use eval() or the array access operator, []. Details here
    http://www.quip.net/blog/2006/flash/actionscript-20/reference-objects-dynamically
    David
    stiller (at) quip (dot) net
    Dev essays:
    http://www.quip.net/blog/
    "Luck is the residue of good design."

Maybe you are looking for