AS3 Playback control of nested movieclips

Hey all,
I'm trying to figure out how to control a movieclip symbol from the timeline.
I've created a Main Timeline with one symbol per frame, a labels layer and an action layer.
Each frame has its own label, and each action keyframe has a listener attached to the current symbol like so:
symb = title_mc;
symb.cacheAsBitmap = true;
symb.mask = f_mask;
symb.focusRect = false;
stage.focus = symb;
symb.addEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
I need the following structure:
From Main timeline Frame
Identify symbol instance (labeled as <name>_mc)
Inside symbol timeline, play from first frame (labeled '0') until next labeled frame ('1' and so on)
stop and wait for next pg_down to start playing from next labeled frame to the following (i.e. '1'-'2'), or pg_up to start playing from the previous labeled frame (i.e. '0' - '1')
on last frame (labeled 'final') exit symbol focus and return keyboard control to main timeline to allow pg_down and pg_up to move to the next / previous frame. on pg_up on symbol.currentFrame == 0, do same.
This is the code I'm currently stuck with:
import flash.events.Event;
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
stop();
f_mask.cacheAsBitmap = true;
var symb:MovieClip;
symb = MovieClip(root); //assign symbol I want to be controlled by pg_up/pg_down
symb.focusRect = false;
symb.addEventListener(KeyboardEvent.KEY_DOWN, mc_pager);  //add keyboard event listener
stage.focus = symb; //focus on current symbol
function mc_pager(e:KeyboardEvent):void{
    var myKey = e.keyCode;
    if (myKey == Keyboard.PAGE_DOWN){
        do{
            symb.play(); // it plays, then checks if the lbl is null or final, then quits
            trace("current: " + symb.currentFrameLabel);
        } while (symb.currentFrameLabel == null && symb.currentFrameLabel != 'final');
        symb.stop();
        symb.removeEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
        stage.focus=MovieClip(root); //return focus to main timeline (in the next keyframes, the focus is on the nested _mc
    if (myKey == Keyboard.PAGE_UP){
        do{
            symb.prevFrame();
        } while (symb.currentFrameLabel == null && symb.currentFrameLabel != '0');
        symb.stop();
        symb.removeEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
        stage.focus=MovieClip(root);
So far, I've tried several different things (including multiple eventhandlers) to no avail. This is what looks best so far, being logically sound (I think). But it doesn't work. Please, I need a hand with this.

use:
function mc_pager(e:KeyboardEvent):void{
    var myKey = e.keyCode;
    if (myKey == Keyboard.PAGE_DOWN){
symb.removeEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
            symb.play(); // it plays, then checks if the lbl is null or final, then quits
            trace("current: " + symb.currentFrameLabel);
             symb.addEventListener(Event.ENTER_FRAME,checkNextFrameF);
    if (myKey == Keyboard.PAGE_UP){
       symb.addEventListener(Event.ENTER_FRAME,checkPrevFrameF);
function checkNextFrameF(e:Event):void{
if(i don't know what you want to check here || symb.currentFrame==symb.totalFrames);
        symb.stop();
symb.removeEventListener(Event.ENTER_FRAME,checkNextFrameF);
symb.addEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
whatever else
function checkPrevFrameF(e:Event):void{
symb.prevFrame();
if(i don't konw what you want to check here || symb.currentFrame==1){
symb.removeEventListener(Event.ENTER_FRAME,checkPrevFrameF);
symb.addEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
//whatever else

Similar Messages

  • Can Captivate 7's playback controls control Flash swf files?

    Hi folks,
    I have created a swf file using Adobe Flash and I have imported it as an animation slide in Captivate 7. I have turned on the playback controls to just have the play button and the progress bar. When I export the presentation, the playback controls do not work. The scrubber moves as the presentation is playing, but I can't pause the presentation. When I stop the scrubber or even move it left or right, it does not affect the presentation and it just keeps playing. Am I doing something wrong? I don't want to have to create a custom nav bar in Flash as it would just be easier to use Captivate's playback bar.

    I don't think it can be expained quickly as it can be very complicated. But...
    Select New Project/Widget in Flash and choose static widget. You need to be very adept in AS3 to actually get them to work.

  • Is there any way to save an image from a nested movieclip as a .png using PNGEncoder

    Hello all,
    I am new to AIR and AS3 and I am developing a small AIR desktop application in Flash CS5 that saves a user generated image locally to their computer. 
    The image is generated from a series of user choices based on .png files that are loaded dynamically into a series of nested movieclips via XML.  The final image is constructed by a series of these "user choices".
    Sourcing alot of code examples from here and there, I have managed to build a "working" example of the application.  I am able to "draw" the parent movieclip to which all the other dynamic movieclips reside and can then encode it using PNGEncoder.  The problem is that the images loaded dynamically into the nested movieclips show as blank in the final .png generated by the user.
    Is there a way to "draw" and encode these nested movieclips or do I need to find another way?  I can provide my clumsy code if required but would like to know if this concept is viable before moving any further.....
    Thanks in advance....

    Thanks for the files.......
    Yeah I'm doing it in Flash but importing the images via an xml document.  The problem isn't in being able to view the eyes (based on the selection of the user) its when I go to save the resulting image as a .png.  When I open up the saved .png the eyes are blank even though they are visible in the swf
    Even when the user clicks on the option to copy the image to the clipboard, it works as intended.
    My only guess is there is an issue with the way my xml is loading (but this appears to work fine) or when the file is converted and saved.....
    As I said I'm still learning but surely there must be a simple answer to this....
    I have included the xml code I am using and also the save code to see if anyone spots an issue..... (I hope I copied it all)
    // XML
    import flash.net.URLRequest;
    import flash.net.URLLoader;
    var xmlRequest:URLRequest = new URLRequest("imageData.xml");
    var xmlLoader:URLLoader = new URLLoader(xmlRequest);
    var imgData:XML;
    var imageLoader:Loader;
    var imgNum:Number = 0;
    var numberOfChildren:Number;
    function packaged():void
    rawImage = imgData.image[imgNum].imgURL;
    numberOfChildren = imgData.*.length();
    imageLoader = new Loader  ;
    imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedImage);
    imageLoader.load(new URLRequest(rawImage));
    faceBG_mc.Eyes.addChild(imageLoader);
    function loadedImage(event:Event):void
    imageLoader.x = -186;
    imageLoader.y = -94;
    imageLoader.width = 373;
    imageLoader.height = 186;
    //  Clipboard
    btn_Copy.addEventListener(MouseEvent.CLICK, onCopyClick);
    function onCopyClick(event:MouseEvent):void
    var bd:BitmapData = renderBitmapData();
    Clipboard.generalClipboard.setData(ClipboardFormats.BITMAP_FORMAT, bd);
    function renderBitmapData():BitmapData
    var bd:BitmapData = new BitmapData(faceBG_mc.width,faceBG_mc.height);
    bd.draw(faceBG_mc);
    return bd;
    // Save faceBG_mc as .png 
    var fileRef:FileReference = new FileReference();
    var myBitmapData:BitmapData = new BitmapData (faceBG_mc.width,faceBG_mc.height, true, 0);
    myBitmapData.draw(faceBG_mc);
    var myPNG:ByteArray = PNGEncoder.encode(myBitmapData);
    function onSaveClickPNG(e:Event)
    fileRef.save(myPNG, "myPNG.png");
    So my problem is....
    The final image is copied to the clipboard with the eyes visible - yes
    The eyes appear in the image in the swf as intended - yes
    When the image is saved as a .png and is meant to include the eyes, they are blank (see picture above)
    I hope this helps.....
    Thanks in advance

  • How to stop and resume the animations of nested movieclips

    Hi
    I have many nested movieclips  in different positions of the main timeline.
    I have 2 buttons, play_btn and pause_btn.
    I'd like when the user click pause_btn, the animations on the main timeline and in nested movieclips stop.
    Whe he click play_btn the animations resume in both the main timeline and nested movieclips.
    I have created array of nested movieclips on the main timeline.
    var arr:Array = new Array(mc1, mc2, mc3, mc4, mc5);
    play_btn.addEventListener(MouseEvent.CLICK, on_play_btn);
    pause_btn.addEventListener(MouseEvent.CLICK, on_pause_btn);
    function on_play_btn(e:MouseEvent):void
         gotoAndPlay(currentFrame);
         for(var i:Number = 0; i < arr.length; i++)
             if(arr[i] != null)
                 arr[i].play();
    function on_pause_btn(e:MouseEvent):void
         gotoAndStop(currentFrame);
         for(var k:Number = 0; k < arr.length; k++)
             if(arr[k] != null)
                 arr[k].stop();
    but it only stops the animations on the main timeline and dosen't stop the animations in the nested movieclips.
    Help me Please.

    I'm having the same issue.I have a main timeline, which has nested movieclips with there own timelines and motion tweens. Using the new motion tween, and not the classic tween, which may or may not be the problem.
    Was having a similar issue with stopping the timeline, the main timeline would stop, but the nested movieclips would keep going. Found this blog post that helped.
    http://blog.nobien.net/2009/02/05/as3-stopping-all-timeline-animations/
    Used the code below to stop everything by passing the stage as the displayObject. Worked great, but now i'm having the reverse issue. When I resume play, the nested movieclip timeline stays exactly where I stopped it, and the main timeline resumes play. If there are a 100 frames in the nested movieclip, once it reaches the 101st frame, the main timeline kicks in again.
    function stopAllChildMovieClips(displayObject:DisplayObjectContainer):void{
            var numChildren:int = displayObject.numChildren;
            for (var i:int = 0; i < numChildren; i++) {
                var child:DisplayObject = displayObject.getChildAt(i);
                if (child is DisplayObjectContainer) {
                    if (child is MovieClip) {
                        MovieClip(child).stop();
                        stopAllChildMovieClips(DisplayObjectContainer(child));

  • Playback control actions

    Hi there - can anyone help me with the playback control is
    captivate.
    I have a captivate demo that i am loading into a flash movie,
    via an empty movie clip on the flash time line, with a loadMovie
    command in flash. What i want to be able to do is to create either
    a javascript command, or some kind of action that will , upon
    pressing the close button in the captivate move - a) close the
    captivate swf, b) send the flash movie to a certain frame in the
    timeline, and play.
    I have tried importing the captivate demo into Flash 8 - the
    results are dissapointing as you lose the caption fades, mouse
    movements, and strangely, the alignment of the text in the caption
    boxes. I would liek to keep the smoothness of the .swf from
    captivate, but also have the movie close upon the user pressing the
    close button.
    Thanks

    I don't know how to solve this, but imagine the issue is
    this:
    The Lectora controls likely suppose the SWF is one long
    timeline.
    Captivate SWFs are movie clips in movieclips with all sorts
    of layering.
    So that's likely why the Lectora controls don't work...on the
    other
    hand, I've never used Lectora so maybe you can specify the
    object
    relationship they're trying to control.
    The question about the audio is likely related to how an
    'event' audio
    clip will not stop when the timeline is stopped and will
    likely run out
    of sync. A 'streamed' audio clip will work as you expect. I
    don't know
    how CP publishes the audio, but would assume 'stream'.
    Best solution, unless Lectora can help, is to NOT use Lectora
    controls
    on the CP SWF but use the CP controls (skin) that are
    published with the
    CP SWF by default... ?
    Erik
    MrsZev wrote:
    > I'm trying to publish my Captivate demos (just the swfs)
    to Lectora 2007, and
    > use Lectora actions to control the playback
    (specifically, to stop them when
    > the Lectora action is executed).
    Erik Lord
    http://www.capemedia.net
    Adobe Community Expert - eLearning
    http://www.adobe.com/communities/experts/
    http://www.awaretips.net -
    Authorware Tips!

  • How to add a custom multimedia playback control to add a time line of what is being played?

    How to add a custom skin in multimedia playback control to add a time line of what is being played?  As it is being played...
    I need a time line so any part of the what is being played can be found by time, ie at 1 minute and 30 seconds in and continues for 45 seconds out of a 50 minute audo.

    If you're talking about a playback controller within the rich media annotation (RMA) then you need to write your own widget in Flash or Flex, and then place the video and widget files using the multimedia "Add Flash" tool in Acrobat instead of the "Add Video" tool. Aside from a bunch of proprietary code to handle events, commenting and the API (which you can live without for basic play-pause-scrub applications), video RMAs are just an embedded SWF file containing an FLVPlayback component. The skin and the video file itself are added to the RMA as resource entries. You can build your own version and have it display whatever controls you want, provided you know how to write ActionScript!
    If you're talking about a controller that's external to the RMA (e.g. a series of links or buttons elsewhere on the page) then in the past you would use FLV video files and the 'cue points' feature that's built into Acrobat - however Adobe removed the ability to create FLV files in the latest version of CC, so unless you have CS6 or earlier it's a non-starter. Instead you can manually set playback start points using the special "multimedia operations" link action in your PDF - though stopping playback at a defined point is very difficult without FLV cues. For that you're back to writing your own widget.

  • Looking for better playback controls

    When I create FLV files for web streaming directly through
    Adobe Flash, I
    can take advantage of many choices of playback controls, my
    favorite one
    being the ArcticExternalAll. The downside: RIPing my slide
    shows takes
    hours.
    The newest version of ProShow Producer has greatly improved
    Flash export,
    allowing me to create high-quality Flash files directly from
    it in a
    fraction of the time -- minutes instead of hours. Its
    downside: Only a
    use-it-or-not choice of one playback control, and it's a
    lousy one.
    I would like to learn more about these playback controls:
    - Which file is responsible for designating the controls, the
    SWF or the
    FLV?
    - Can the user swap one control for another?
    - Can I take the external ArcticExternalAll.swf and somehow
    patch the video
    to include the control file?
    Any input is appreciated...
    Rick A.
    Pleasanton CA

    I misspoke, then, or I was not specific enough. I take AVI
    files and import
    them into Flash and then publish them as FLVs. That is the
    sum total of my
    experience using Flash.
    However, I am an advanced computer user and a quick study, so
    if you were to
    point me in the right direction, that is likely all I would
    need...
    RA
    "kglad" <[email protected]> wrote in message
    news:gip1dr$nmp$[email protected]..
    > you indicated you knew how to use the flvplayback class
    to stream flv
    > files. that's one way to do it.

  • IPad mini losses playback controls/capabilities using shared library content videos

    While accessing my shared "authorized" video library on my MacBook Pro, using the latest iTunes version (as of this submission), with my sparkling new iPad mini, the playback controls simply disappear usually after a few minutes, i.e. no progress bar, buttons for stop/start/pause/"done".
    The video stream from the shared library cannot be stopped without the on-screen controls so we either attempt to turn off the unit (pressing the top on/off button) or (usually) press the home button after which the video stream/app stops then return to the expected ipad screen but the residual sound stream will continue to run indefinitely.
    Most of the time, we hit the home button to end the video playback then wait for the sound stream portion to end which on average takes up to 1-5 minutes to stop completely.
    This is repeatable too. 
    SUMMARY:
    1). Without power cycling, we can play a video from the shared librar
    2). then wait long enough for the video controls to "go missing" or again go unresponsive
    3.) then press the home button which returns you to your normal iPad screen
    4.) but the sound stream portion will take a while to take its course before ending.
    Also, we gave power-cycling between issues but the each and every time, the shared library video playback inevitably ended up with same results.
    iPad mini with iOS 6.1.3 factory , wifi only unit with legitimate software, etc. I.e. no jailbreak nonsense.
    Any suggestions?  Or is this a glitch/bug which needs addressing?  Or a simple setting on the unit?
    Thanks in advance!!!

    I have nearly the same problem, but with an iPad 3rd generation. The symptoms are exactly the same, just a different device.
    You documented the problem well, I can only add that resetting and reloading did not solve the problem for me.

  • Create playback controls for Timeline in sync with audio?

    Hi All,
    Technically, I've combined two questions into one. Firstly, can someone offer some insight on how to create playback controls for an Edge animation so the user can essentially "scrub" the timeline or navigate to a specific point on the timeline. I know you can create buttons to "sym.play()" different areas but I was wondering if there was a more streamlined solution (something similar to video playback controls.) Next, I'd like the user to be able to skip to different locations while the music remains in sync with the animations. I've created a few buttons to attempt to achieve this but the music plays independently regardless of where I jump to on the timeline.
    Any help would be most appreciated.
    Thanks in advance!

    I had some ideas why that may be so, but then, when I thought about it, properly, i have no idea why it is that way. Maybe it is because audio has a higher priority than graphics, in OS X, but if I remember correctly, it was like this before OS X. Maybe there is an offset for latency compensation, but they made it too large. (it seems to be the same amount, no matter what the buffer size is)
    just to make sure we are seeing the same thing. on my (somehat old) G4 I'm seeing about 60ms difference.

  • Playback Controls Do Not Function

    I have created movies that have the playback control located
    at the bottom center of the movie. I have published the movie in
    both SWF and HTM formats. Usually, the forward, rewind, pause, etc.
    buttons work but the Exit button does not work.
    Does anyone know why it doesn't work? How can I make it work?
    I do not know javascript, if you are going there. I am not a
    developer. I am a software trainer struggling to make a
    demonstration movie work. Any help would be greatly appreciated.
    Please help quickly! I am in a bind!

    Hi Susan
    Here is one thing to try. It may or may not work, but may be
    worth a shot.
    Insert the following code:
    JavaScript:var
    pw=window.parent;pw.opener=window.self;pw.close();
    Where?
    * Insert > Button
    or
    * Insert > Click box
    or
    * Movie > Preferences > Start and end tab > Movie
    End Options.
    Configure "Execute JavaScript" as the action.
    Click the ellipsis (...) button to produce another dialog.
    Paste code from above into the dialog.
    Click OK to dismiss the dialog.
    Click OK to dismiss the properties or preferences dialog.
    Publish and test the movie.
    Cheers... Rick

  • Premiere Pro CC Source and Program Playback Controls not working.. help please.

    Hi,
    Need your help to find out why none of the Premiere Pro CC Source and Program Playback Controls are working.. I can do playback using spacebar, but not clicking on the controls... same goes the rest.
    Thank you,
    Mauro

    Dear Mark,
    Thank you for the hint/link, reseting the toolbar did the trick.
    Regards,
    Mauro

  • Full Screen Playback Control Impossible Using Monitor 2 in Dual Monitor

    Recent iTunes update (patch didn't fix) causes playback control to disappear when the cursor is on the monitor showing the movie. Controls reappear when cursor is moved to first monitor. User cannot get the cursor near the control panel. Must drop out of full screen playback to touch controls with the cursor.

    Isn't there a SINGLE MONITOR option in COLOR? Use that.
    I don't think two graphics cards will work with Color, as Color relies on the card when it comes time to render. Might mess it up, or not work.
    Shane

  • Frame Offset Playback Control in FCP HD Not Working

    if I output my audio via firewire, it works just fine. However, I am unable to playback audio in sync via built-in audio (which sounds far better than my firewire output device).
    I've gone to to my FCP System Preferences; Playback Control and it has a default offset of 4 frames. But it's still out of sync. However, if I manually offset my audio in the timeline by 4 frames, it's IN sync. I've tried various frame rates in the Playback and it never syncs, in fact it appears as though nothing is changing, no matter what I set it at.
    What am I overlooking or doing wrong? It just doesn't make sense.

    I'm having the same problem on capture. I'm migrating from a PowerBook 800 to an Intel Imac. I need the Keyspan Serial to USB adapter to run the 422 port on my BetaCam player. I finally got it hooked up tonight.
    I grabbed a piece of video, and I'm getting two error's. First, like you, I'm 4 frames off (I'm using a Window Dub so I see the offset). Secondly, when I stop the capture I get a window telling me there is some discrepancy with my captured audio rate. When I look at the setting for the clip, all the frame rates seem to match. When I check the video, the lip sync is indeed off.
    So I'm using the same Keyspan adapter I've bee using using in Panther. Now I'm in Tiger, and I have what seems to be the latest, Intel Mac Keyspan update.
    But when I type in an offset number. and hit return, it doesn't "take". There is no change on the offset if I do another capture, and when I go back to the setting, it is at zero. I remember in Panther the current offset number was always visible.
    Any suggestions? I'm trying to get the offset to take, so I can capture proper time code on this BetaCam dub.
    Thanks.
    Powerbook G4   Mac OS X (10.3.9)  

  • Is it possible to customize the playback controls bar in a dvd flash?

    Is it possible to customize the playback controls bar in a dvd flash?
    I mean is it possible to change the size of the bar? and the size of the controls?
    Is it possible to remove (not hide or disable but remove from the bar) some controls as "search", "title" ecc...
    Thank You...

    CS5 greatly improved the options for player configuration.
    http://help.adobe.com/en_US/encore/cs/using/WS130B1F01-AE62-4c59-BA44-F29ACD8522EEa.html#W Sf01dbd23413dda0e-3ea68760123ebe30b7c-7ff2
    I have not played with this enough to answer your specific questions. Let us know.

  • Video playback control won't show after upgrade to 3.1

    Hi,
    I have a iPod Touch 2nd Generation. After upgrading from 2.2 to 3.1, when I tap the video during video playback, the playback control won't show. I have to tap it many many times in order for the playback control to show. Does anyone have the same problem? Does anyone know how to fix it? It is upsetting to pay for an upgrade that would break existing behavior.
    Thanks.

    I have the same problem and the reset didn't fix it. In fact I went in to the store and the Apple Genius saw the issue and replaced my ipod with a rebuilt ipod that had ipod 2.x software. I upgraded it to 3.2 and once again the playback controls don't show up. Called support and they think it's a bug ... hoping for a fix.
    Any ideas?

Maybe you are looking for

  • Error while updating table

    Hi, I am using oracle 11g db. Trying to update one of my table using following query : UPDATE EMPLOYEE_HISTORY_ALL_T TMDC SET LAST_UPDATE_DATE = '01-apr-1901' WHERE EXISTS (SELECT 1 FROM PROJECT_T TMP WHERE TMP.PROJECT_ID = TMDC.PROJECT_ID AND NVL(TM

  • PO Output Type not picked

    Dear Experts , I have defined a new condition table for PO o/p as  Doc Type/P Org/Vendor/Plant. I assigned this table to the access seq & the acces seq to the output type . Then I maintained Condition record for this acces seq But the output tupe is

  • Process instance creation on 5.5 from a process A to a process B Dif engine

    Process Instance creation on 5.5 from a Process A to a Process B on different engine. I have 5.5 enterprise with 2 engines. I want to create a process instance from process a to process b this is the example that is working if processes are deployed

  • Use of Synchronized  in jsp/servlet

    Can any one explain me the use of Synchronized in servlet/jsp which is multithreaded Is this correct synchronized should be used only when we want to pritect Static variable as they have only one copy but in case of instance variable they have sepera

  • Dv9700 Graphics Card Failing

    So my computer has been having a problem for the past month, which involves my Nvidia graphics card. The card is the 8600 M model for laptop computers. The problem can be described as this, increased and unchangeable resolution, color problems on the