MovieClip & Event.FRAME_CONSTRUCTED

Hi,
I got a little trouble when I was using Event.FRAME_CONSTRUCTED with MovieClips, I want to know if I was rgiht about: If a movie clip contains only one frame, when MovieClip.goto() function is called, Event.FRAME_CONSTRUCTED is dispatched depends on flash player version.
I realize it when I was debugging something else, so is that correct, and is there any way that I can know if a movieclip is already "FRAME_CONSTRUCTED" so I don't need to add event listener(such as, mc.isConstructed?).
Thank you for any information.

Oh god, I am ashamed, I think I figure it out now.
First, when I say "I found in different run-time, movieclips dispatchFRAME_CONSTRUCTED event differently",  this is because bug in my own code, event handler is fired, but before I trace() any information, it returns because some logic error. so I thought the event is not dispatched, I was wrong.
So now I need to do some demos to find out how movieclips dipatch FRAME_CONSTRUCTED(with those movieclips with one single frame, and in different version of flash players).
But I still what to know the answer to my second quesion " is there any way that I can know if a movieclip is already "FRAME_CONSTRUCTED" so I don't need to add event listener(such as, mc.isConstructed?)". It will be very helpful if there's any way.
And here I want to ask another quesion, it's a quesion related to the topic, but it's a different one. My quesion is : when I caching movieclips to bitmapData, I find somehow sometimes, the return of method MovieClip.getBounds() is not right EVEN I call it after or when the movieclip dispatches FRAME_CONSTRUCTED event. So what I got is a animation that is "trambling" because I got wrong position of some of the frames of that movieclip(I put bitmapData I cached onto Bitmaps, and set it's position according to what MovieClips.getBounds() tells me).
So any information or suggestion? Thank you.

Similar Messages

  • MovieClip Event handling problem

    hi all I m trying to make an drawing app, I make a 1 button for create drawing shape (square shape)
    user can draw square and circle on a blankpage movieclip, but the problem is when we click on squre button then i m changing mousecursor to crosshair cursor( instancing and startdraging a moviclip from library) then user no-one movieclips event works.. I need that I can click on paper and able to draw rectangle. thankyou for help.
    you can download the file from here
    https://sites.google.com/site/amit0shakya/home/mousecursor-click
    amit shakya
    [email protected]

    change your code as:
    private function startDraw(event:MouseEvent):void
       crossCursor=new Mcursor()
       addChild(crossCursor);
       crossCursor.startDrag(true);
       crossCursor.mouseChildren=false;
       crossCursor.mouseEnabled=false;
       Mouse.hide()
       if(event.target.name=="rectangleMC")
        whichShape="rectangle"

  • Components disrupting MovieClip events.

    I am writing a program (in Flash 8 with AS 2.0) to run
    through chess games loaded from PGN files.
    I need buttons that do the following: Go to Next Move, Go to
    Previous Move.
    I have created a couple of MovieClip buttons with
    onRollOver/onRollOut and onPress event functions
    (The RollOver and RollOut events are used just to
    apply/remove filters to highlight/dehighlight the buttons)
    Simple. Works fine.
    BUT I then add a ComboBox component to the stage.....
    The buttons work fine UNTIL I CLICK ON THE COMBOBOX.
    After that, if I roll over a button I get a 'RollOver' event
    (o.k.)
    I press the button and I get a 'Press' event (o.k.)
    immediately followed by a 'RollOut' event (NOT o.k.!)
    Now, without moving the cursor off the button, every
    subsequent press causes a 'RollOver' immediately followed by a
    'RollOut' event (but NO 'Press' event).
    I do not get another 'Press' event until the cursor has moved
    off the button and then over it again, when I get a repeat of the
    above (i.e. Press+RollOut after first press then RollOver+RollOut
    after subsequent presses.
    I can reproduce the problem as follows:
    1. Create a new Flash Document
    2. Draw a shape on the stage and convert it to a MovieClip
    named 'btn1'.
    3. Place a ComboBox named 'cbox1' on the stage.
    4. Add the following script to frame 1...
    btn1.onRollOver = function() { trace( "RollOver" ); }
    btn1.onRollOut = function() { trace( "RollOut" ); }
    btn1.onPress = function() { trace( "Pressed" ); }
    That's all! (The ComboBox does nothing and has no event
    listener assigned to it.)
    The button works fine UNTIL THE COMBOBOX IS CLICKED.
    After that you get the situation described above!
    I'd really appreciate if anyone can
    (a) tell me if they can reproduce the problem or, better
    still,
    (b) let me know what's going on and how I can solve this.
    Cheers.
    (p.s. it's not just the ComboBox component. I've had the same
    problem with e.g. an Input TextField)

    Thanks for trying.
    This one's driving me mad.
    The only work-around I've come up with is to place the
    ComboBox in a separate MovieClip, attach it only when it is needed,
    and then remove the MovieClip, which is a real pain.

  • MovieClip Event

    Hi, does anybody know how to make an event to execute a
    function (like addEventListener) when a exisisting movieclip enters
    in his frame 10?
    Thank you very much,
    Víctor

    either call the function from frame 10 or use an ENTER_FRAME
    listener to check when your movieclip reaches frame 10 and then
    call the function.

  • Event.FRAME_CONSTRUCTED Not consistent?

    Hi guys =)
    Still got problem with my application, and I was hoping to get some help from you guys.
    I'm saving each frame of a .FLV file to an array, but there seeme to be a problem with my framerate.
    If I set the application framerate to 25, and encode my .flv to 25, it works. But I need to play through the animation faster to buffer it to my array as fast as possible.
    So I've set my application framerate to 100 (tried 50 too, but more seemes better), and my .FLV encoding to 50FPS.
    Problem now, is that the first second or two it seemes to skip frames. And later on, it seemes to be saving the same frame multiple times..?
    Here is the code: http://codeviewer.org/view/code:2090

    Thanks
    How would you go about to buffer a .FLV file to an array as fast as possible?
    I'm capturing each frame with BitmapData.draw(), and my goal is to run through all the frames as fast as possible and save them to my array. When this is done, it's removed. I now use the buffered frames..
    (the faster the better. This reduces the loading time, of course).

  • Remove MovieClip with event.target.content

    Hi every one please i need your help i have this code and i want to remove baresClip but i cante removeit please helpme
    var loaderBares:Loader = new Loader();
        loaderBares.unload();
        loaderBares.load(new URLRequest("negocio/bares.swf"));
    loaderBares.contentLoaderInfo.addEventListener(Event.COMPLETE,loadBares);
    function loadBares(event:Event){
              var baresClip:MovieClip = event.target.content;
              baresClip.x= -474;
              baresClip.y= -135;
              addChild(baresClip);
    baresClip.over1.receta1.addEventListener(MouseEvent.CLICK, prueba);
              function prueba(event:MouseEvent):void{
                                  gotoAndStop("receta1");
                                  removeChild(baresClip); /*Here is working*/
    MovieClip(root).mc_negocio.menu_negocio.btn_botanas.addEventListener(MouseEvent.CLICK, goToBotanas);
    function goToBotanas(event:MouseEvent):void
      removeChild(baresClip);   /*Here is not working*/
              gotoAndPlay("botanas");

    oh, i see what you're doing.  you made baresClip local to loadBares.
    to remedy, use:
    var baresClip:MovieClip
    var loaderBares:Loader = new Loader();
        loaderBares.unload();
        loaderBares.load(new URLRequest("negocio/bares.swf"));
    loaderBares.contentLoaderInfo.addEventListener(Event.COMPLETE,loadBare s);
    function loadBares(event:Event){
              baresClip = event.target.content;
              baresClip.x= -474;
              baresClip.y= -135;
              addChild(baresClip);
    baresClip.over1.receta1.addEventListener(MouseEvent.CLICK, prueba);
              function prueba(event:MouseEvent):void{
                                  gotoAndStop("receta1");
                                  removeChild(baresClip); /*Here is working*/
    MovieClip(root).mc_negocio.menu_negocio.btn_botanas.addEventListener(M ouseEvent.CLICK, goToBotanas);
    function goToBotanas(event:MouseEvent):void
      removeChild(baresClip);   /*Here is not working*/
              gotoAndPlay("botanas");

  • MovieClip getBounds

    Hi.
    I found something when I create bitmap data cache for each frame of a movie clip:I got a movie clip, instead of presenting it immediatly on stage, I created a bitmap data array to store each frame of it, so I'm doing:
    var body:MovieClip;     // some mc for body
    var suit:MovieClip;     // some mc for suit, frame count is the same as body mc
    body["part"].addChild(suit);     // it's a avatar, there's a sprite named "part" on body mc to contain suit mc
    var totalFrame:int = body.getTotalFrame();
    var cache:Vector.<BitmapData> = new Vector.<BitmapData>();
    var cacheBounds:Vector.<Rectangle> = new Vector.<Rectangle>();
    for(var i:int = 1; i <= totalFrame; i++) {
         body.gotoAndStop(i);
         suit.gotoAndStop(i);
         var rect:Rectangle = body.getBounds(null);
         var bmpData:BitmapData = new BitmapData(rect.width, rect.height, true, 0);
         var mat:Matrix = new Matrix();
         mat.tx = -rect.x;
         mat.ty = -rect.y;
         bmpData.draw(body, mat);
         cacheBounds.push(rect.clone());
         cache.push(bmpData);
    ////// present ////////
    container = new Sprite();                                        // sprite to present cached bitmapdata
    bmpCanvas.bitmapData = cache[currentFrame];
    bmpCanvas.x = cacheBounds[currentFrame].x;
    bmpCanvas.y = cacheBounds[currentFrame].y;
    contaner.addChild(bmpCanvas);
    if i present the original body moive clip, everything is ok, but when I use cache, it begins to tremble, this is because the getBounds() method of movieclip returns different rectangle when mc is cached and mc is presented on stage. I tried trace out every getBounds() when caching and when Event.FRAME_CONSTRUCTED fire, they're different, making my cache crash!
    I assum MovieClip class do not refresh until it's present to stage or some time in on frame, how can I get the real boundary of it if I need to cache it? Thanks for any advise!

    ... body.getBounds(contaner);
    body needs to be added to the display stack (added either to the stage or contaner) before you can use the getBounds method.

  • How do I reference a dynamically created MovieClip from another MovieClip?

    Hi,
    I'd be grateful for any pointers to the following problem:
         I'm having trouble referencing dynamically created MovieClips (links in a side panel on a Flash website, created from an XML file) from the current MovieClip (the currently selected link).
         I wish to freeze the the link/MovieClip in its mouseOver state once it has been clicked - this part works. When a new link/MovieClip is clicked on, I wish to release the previously clicked-on link from its mouseOver state, which is what I've so far been unable to do.
         My problem seems to be referencing the previous link/MoveClip. I've used the trace statement trace(MovieClip(this).name) to determine that the MovieClips are named item0, item1, item2 and so on. However, I've been unable thus far to reference the previous clip thus far. I've tried to trace the route to the MovieClip from the stage, and also tried MovieClip(parent).item0.gotoAndStop and lots of other different permutations, but to no avail. It's the fact they seem to be in a container called 'panel' which is defeating me.
         Here's a live version I've uploaded, which might explain the problem better. Click on "UBER UNS" in the top menu bar to get to the page in question. It's the links on the left-hand side (Historie, Unser Team, etc.) which are the problem. You'll see that once they've been clicked on they remain in their mouseOver state.
         This is the code in question on the fla file, which is a file I did not create myself. The parts in black work fine; it's the red parts where the problem lies:
    import flash.display.MovieClip;
    panel.buttonMode = true;
    var lang:uint = 1;
    var url_Link:String=MovieClip(root).program.websiteXML .language[lang].pages.titlePage[MovieClip(root).program.linkPage].texts.pageList.txt[numT XT].@link;
    var urlPage:Number=Number(MovieClip(root).program.webs iteXML.language[lang].pages.titlePage[MovieClip(root).program.linkPage].texts.pageList.tx t[numTXT].@linkPage);
    var request:URLRequest;
    var linkIndex:uint;
    var lastClickedLink:MovieClip;   //This is supposed to store the last link that has been clicked - it doesn't work
    panel.addEventListener(MouseEvent.CLICK, clicLink);
    panel.addEventListener(MouseEvent.ROLL_OVER, mouseOverLink);
    panel.addEventListener(MouseEvent.ROLL_OUT, mouseOutLink);
    function mouseOverLink(event:MouseEvent):void {
          MovieClip(this).gotoAndPlay('s1');
    function mouseOutLink(event:MouseEvent):void {
          if(numTXT !== (linkIndex - 1)/5){         //freezes mouseOver state if this is the link for the current page
               MovieClip(this).gotoAndPlay('s2');
    function clicLink(event:MouseEvent):void {
          var linkpage:uint = MovieClip(root).program.linkPage;
          if (url_Link) {
               request = new URLRequest(url_Link);
               navigateToURL(request);
          } else {
               linkIndex = numTXT * 5 + 1;
               if(linkpage == 1){
                   MovieClip(root).chPages.cont.page_about_mc.page3Tu  rner_mc.gotoAndStop([linkIndex]);
              } else if (linkpage == 2){
                   MovieClip(root).chPages.cont.page3_mc.page3Turner_  mc.gotoAndStop([linkIndex]);
         lastClickedLink.gotoAndPlay('s2');  // this is supposed to release the previous clicked-on link from it's mouseOver state - doesn't work
         lastClickedLink = MovieClip(this).name;    //this is supposed to set the new link as the last link clicked after the old one has been released from it's mouseOver state - doesn't work
    If anyone can help, that would be great.

    What you might be after for that line is to use:
    lastClickedLink = MovieClip(event.currentTarget);
    For what you show, the name property of an object is a String, so I would expect you to be getting an error regarding trying to get a String to act like a MovieClip when you try to tell it to gotoAndPlay('s2').

  • .removeEventListener(Event.ENTER_FRAME  is not working please help

    hey guys... so i have a new problem... basically im trying to load a swf, and for this swf to load properly i need to pass it an id, and when the swf, after using the id gets all the necessary data, sets a variable called loadCompleted to true
    The problem is after my code encounters the loadComplete == true, it adds an image of that swf to my tileList, and it adds a million of these images, indicating that my event never got removed.... any ideas??
    i have the following code
    private function swfLoaded(event:Event):void{
         trace("-------------> in function swfloader");
         childSwf = new MovieClip();
         childSwf = event.target.content;
         childSwf.init(name[1]);
         childSwf.addEventListener(Event.ENTER_FRAME, compFrameEntered);
    private function compFrameEntered(event:Event):void{
         if(childSwf.currentFrame == childSwf.totalFrames){
              if(event.target.loadComplete == true){
                   trace("<<<<< load complete: " + event.target.loadComplete);
                   childSwf.removeEventListener(Event.ENTER_FRAME, compFrameEntered);
                   var myClip:MovieClip = event.target as MovieClip;
                   var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(myClip);
                   var imgData:Bitmap = new Bitmap(imageBitmapData);
                   slideImages.addItem(imgData);
                   trace("load complete company ");
    it not only adds a million same images, but it also displays "load complete company" a million times....
    any ideas?? any help is greatly appretiated! ive been having this problem for a couple of days now

    hi,
    It seems they have changed how it works,
    https://acrobat.com/    when I go here it is automatically logged me in to a page that allowed me to start a meeting
    David

  • Adding "loading" movieclip to dynamic image gallery?

    Hello again,
    I've completed my XML-driven image gallery, however upon live testing I'd realized I made a rookie mistake and not put some kind of placeholder "loading" movie clip loop while the thumbnails—and subsequent full-size images—are being loaded. The images will randomly appear when loaded and I would like to be able to insert a placeholder movie clip while they load, and swap them up with the thumbnails/images after it has been loaded. The placeholder movie clip is in my library (loadingLoop), but I'm having problems getting it to work correctly.
    Below is the original function that processes the XML and adds the thumbnail images; this is where I'm trying to insert the placeholder movie clip per XML child node (every attempt I've made just keeps throwing more errors, so I've omitted my attempts to avoid confusion), and I've attached the XML file for testing. And insight or help would be appreciated.
    //Locate the external XML file and trigger xmlLoaded when complete
    xmlLoader.load(new URLRequest("data/artGallery.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
    //Load the XML and process the image locations
    function xmlLoaded(event:Event):void {
        xml = XML(event.target.data);
        //parse the nodes in the XML file
        xmlList = xml.children();
        //count the number of nodes in the XML file via XMLList
        trace(xmlList.length());
        //loop to load all of the thumbnails, based on the number of nodes in XMLList
        //"i" = every child node in the XML file
        for (var i:int = 0; i < xmlList.length(); i++) {
            //Add loadingLoop movie clip per node and wait for thumnail to load before swapping out with imageLoader thumbnail images <-- help!!
            //for every node, create a new instance to be put on stage
            imageLoader = new Loader();
            //load each thumbnail from its location per XML node's "thumb" attribute
            imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
            //position of thumbnail instances per XML node (horizontally across stage)
            imageLoader.x = i * 110 + 10;//thumbs are 100 x 100 so, +10 to the width, plus +10 from left edge
            //imageLoader.y = 10;
            //for each node in XML list, name the instance with the path to the location of the full size image
            imageLoader.name = xmlList[i].attribute("source");
            //for each node in the XML list, add a drop shadow
            imageLoader.filters = [thumbDShadow];
            //add thumbnails to stage
            addChild(imageLoader);
            dropTween = new Tween(imageLoader, "y", Bounce.easeOut, -100, 10, 1, true);
            //set up thumbnails to wait for a click to execute showPicture
            imageLoader.addEventListener(MouseEvent.CLICK, showPicture);
            //set up thumbnails to scale when rolled over
            imageLoader.addEventListener(MouseEvent.ROLL_OVER, sizeUP);

    Somehow I had a feeling this wouldn't be a copy-and-paste job for the full-size images. Sorry to be a bother. This is the showPicture function that is fired off when the thumbnail image is clicked (from our previous example). Two errors are thrown:
    When the thumnail is clicked:
    "Error #2007: Parameter child must be non-null.
        at flash.display::DisplayObjectContainer/removeChild()
        at MethodInfo-51()"
    But the full-size image loads nonetheless. The second loading loop (loadingLoop2) is not removed. Below is the showPicture function:
    //Load the full-size images and place onto the stage
    function showPicture(event:MouseEvent):void {
        //add new movie clip container
        var mc2:MovieClip = new MovieClip();
        addChild(mc2);
        //clear the fullLoader—this is to help clear any full-size images that may already be on the stage (they have two options, click a new thumbnail, or close the current full-size image
        fullLoader.unload();
        //re-create the fullLoader, if there was one cleared
        fullLoader = new Loader();
        //load each full size image from its location per XML node's "source" deliniated by mc.ldr's "source" attribute
        fullLoader.load(new URLRequest(event.target.name));
        //add the loder to the container
        mc2.addChild(fullLoader);
        //create new instance of second loading loop
        mc2.fsloop = new loadingLoop2();
        //add the second loading loop to the container
        mc2.addChild(mc2.fsloop);
        //for each container, add a drop shadow
        mc2.filters = [fullDShadow];
        //set the container's position center on stage, making it the size of the loading loop until the full-size images are loaded
        mc2.x = (stage.stageWidth - mc2.fsloop.width) * 0.5;
        mc2.y = (stage.stageHeight - mc2.fsloop.height) * 0.5;
        //place container on stage
        addChild(mc2);
        //fade in each container
        fadeTween = new Tween(mc2, "alpha", None.easeNone, 0, 1, 0.5, true);
        //check to see if the image has been loaded completely—this is to make sure the image's attributes can be used to re-center on stage and remove fsloop
        fullLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, removeLoop2);
        //set field to multiline so that the <br> HTML tags can be used
        imageTextField.multiline = true;
        //add text frame for description
        imageTextField.x = 10;
        imageTextField.y = 125;
        //for each full-size image, load the description text from the XML child nodes
        for (var j:int = 0; j < xmlList.length(); j++) {
            //check to make sure that the correct full-size image matches the text node when clicked
            if (xmlList[j].attribute("source") == event.target.name) {
                //add each child node as a separate line in the same text field; added HTML tags for CSS application
                imageTextField.htmlText = "<p><span class = 'projectName'>" + xmlList[j].child("projectName") + "</span><br>"
                + "<span class = 'toolsUsed'>" + xmlList[j].child("toolsUsed") + "</span><br><br>"
                + xmlList[j].child("projText") + "<br>"
                + "<span class = 'liveURL'>" + xmlList[j].child("liveURL") + "</span></p>";
        function removeLoop2(event:Event):void {
            //re-position the container to center on stage to accomodating the full sized image
            mc2.x = (stage.stageWidth - fullLoader.width) * 0.5;
            mc2.y = (stage.stageHeight - fullLoader.height) * 0.5;
            //Add the text field
            addText();
            //hide instructional text, already on stage
            galleryInfo_mc.alpha = 0;
            //remove the full-sized loading loop
            event.target.loader.parent.removeChild(MovieClip(event.target.loader.parent).loadingLoop2 );
        //set up full-size images to "self close" by clicking on it
        mc2.addEventListener(MouseEvent.CLICK, clearStage);
    The second error gets thrown when the container is clicked and the function clearStage is executed, which does not remove the container:
    "TypeError: Error #2007: Parameter child must be non-null.
        at flash.display::DisplayObjectContainer/removeChild()
        at artGallery_v1_5_fla::MainTimeline/clearStage()"
    This is the clearStage function:
    //Allow full-size image to "self close" by clikcing on it and removing the text description
    function clearStage(event:MouseEvent):void {
        //clear the fullLoader
        fullLoader.unload();
        //remove the container
        event.target.parent.removeChild(MovieClip(event.target.parent).mc2);
       //remove the text field
        removeChild(imageTextField);
        //show the instructional text that is on-stage
        galleryInfo_mc.alpha = 1;
    Help!

  • Attached corresponding image in mouse without using event.target.name in actionscript 3

    Hi,
    AS3:
    How to get general id (or) name from xml loaded images. bcoz, i want to drag and drop that images in generic method. Now, i currently used the event.target.name for each one.
    So, code length was too large. See my code below.
    /*********loading images through xml********/
    var bg_container_mc:MovieClip
    var bg_bg_myXMLLoader:URLLoader = new URLLoader();
    bg_bg_myXMLLoader.load(new URLRequest("xml/backgroundimages.xml"));
    bg_bg_myXMLLoader.addEventListener(Event.COMPLETE, processXML_bg);
    function processXML_bg(e:Event):void {
              var bg_myXML:XML=new XML(e.target.data);
              columns_bg=bg_myXML.@COLUMNS;
              bg_my_x=bg_myXML.@XPOSITION;
              bg_my_y=bg_myXML.@YPOSITION;
              bg_my_thumb_width=bg_myXML.@WIDTH;
              bg_my_thumb_height=bg_myXML.@HEIGHT;
              bg_my_images=bg_myXML.IMAGE;
              bg_my_total=bg_my_images.length();
              bg_container_mc = new MovieClip();
              bg_container_mc.x=bg_my_x;
              bg_container_mc.y=bg_my_y;
              ContentHead.addChild(bg_container_mc);
              for (var i:Number = 0; i < bg_my_total; i++) {
                       var bg_thumb_url=bg_my_images[i].@THUMB;
                        var bg_thumb_loader = new Loader();
                       bg_thumb_loader.load(new URLRequest(bg_thumb_url));
                       bg_thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded_bg);
                       bg_thumb_loader.name="bg_load"+i;
                       bg_thumb_loader.addEventListener(MouseEvent.MOUSE_DOWN, bg_down)
                       bg_thumb_loader.x = (bg_my_thumb_width-18)*bg_x_counter;
                       bg_thumb_loader.y = (bg_my_thumb_height-45)*bg_y_counter;
                       if (bg_x_counter+1<columns_bg) {
                                 bg_x_counter++;
                       } else {
                                 bg_x_counter=0;
                                 bg_y_counter++;
    function thumbLoaded_bg(e:Event):void {
              var my_thumb_bg:Loader=Loader(e.target.loader);
             var sprite:Sprite = new Sprite();
              var shape:Shape = new Shape();
              shape.graphics.lineStyle(1, 0x0098FF);
              shape.graphics.drawRect(e.target.loader.x-2, e.target.loader.y-2, e.target.loader.width+4, e.target.loader.height+4);
              sprite.addChild(shape);
              sprite.addChild(my_thumb_bg);
              sprite.x=4;
              bg_container_mc.addChild(sprite);
              my_thumb_bg.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded_bg);
    //  get name for each image. 
    I want to change this code in generic method. do needful.
    function bg_down(event:MouseEvent):void {
              var bg_name:String=new String(event.currentTarget.name);
              var bg_load:MovieClip=event.currentTarget as MovieClip;
              if (event.currentTarget.name=="bg_load0") {
                      var alaska_mc:alaska_png=new alaska_png();
                       addChild(alaska_mc);
                       alaska_mc.x=stage.mouseX;
                       alaska_mc.y=stage.mouseY;
                       alaska_mc.name="alaska_duplicate"+alaska_inc;
                       alaska_inc++;
                       alaska_mc.startDrag(false);
                      alaska_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
                       alaska_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load1") {
                       var lake_mc:lake_png=new lake_png();
                       addChild(lake_mc);
                       lake_mc.x=lake_mc.mouseX;
                       lake_mc.y=lake_mc.mouseY;
                       lake_mc.name="lake_duplicate"+lake_inc;
                       lake_inc++;
                       lake_mc.startDrag(false);
                       lake_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load2") {
                       var mountn_mc:mountn_png=new mountn_png();
                       addChild(mountn_mc);
                       mountn_mc.x=mountn_mc.mouseX;
                       mountn_mc.y=mountn_mc.mouseY;
                       mountn_mc.name="mountn_duplicate"+mountn_inc;
                       mountn_inc++;
                       mountn_mc.startDrag(false);
                       mountn_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load3") {
                       var town_mc:town_png=new town_png();
                       addChild(town_mc);
                       town_mc.x=town_mc.mouseX;
                       town_mc.y=town_mc.mouseY;
                       town_mc.name="town_duplicate"+town_inc;
                       town_inc++;
                       town_mc.startDrag(false);
                       town_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load4") {
                       var water_mc:water_png=new water_png();
                       addChild(water_mc);
                       water_mc.x=water_mc.mouseX;
                       water_mc.y=water_mc.mouseY;
                       water_mc.name="water_duplicate"+water_inc;
                       water_inc++;
                       water_mc.startDrag(false);
                      water_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load5") {
                       var city_mc:city_png=new city_png();
                       addChild(city_mc);
                       city_mc.x=city_mc.mouseX;
                       city_mc.y=city_mc.mouseY;
                       city_mc.name="city_duplicate"+city_inc;
                       city_inc++;
                       city_mc.startDrag(false);
                      city_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load6") {
                        var citywide_mc:citywide_png=new citywide_png();
                       addChild(citywide_mc);
                       citywide_mc.x=citywide_mc.mouseX;
                       citywide_mc.y=citywide_mc.mouseY;
                       citywide_mc.name="citywide_duplicate"+citywide_inc;
                       citywide_inc++;
                       citywide_mc.startDrag(false);
                      citywide_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load7") {
                       var downtown_mc:downtown_png=new downtown_png();
                       addChild(downtown_mc);
                       downtown_mc.x=downtown_mc.mouseX;
                       downtown_mc.y=downtown_mc.mouseY;
                       downtown_mc.name="downtown_duplicate"+downtown_inc;
                       downtown_inc++;
                       downtown_mc.startDrag(false);
                      downtown_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load8") {
                       var powerlines_mc:powerlines_png=new powerlines_png();
                       addChild(powerlines_mc);
                       powerlines_mc.x=powerlines_mc.mouseX;
                       powerlines_mc.y=powerlines_mc.mouseY;
                       powerlines_mc.name="powerlines_duplicate"+powerlines_inc;
                       powerlines_inc++;
                       powerlines_mc.startDrag(false);
                      powerlines_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load9") {
                       var tropical_mc:tropical_png=new tropical_png();
                       addChild(tropical_mc);
                       tropical_mc.x=tropical_mc.mouseX;
                       tropical_mc.y=tropical_mc.mouseY;
                       tropical_mc.name="tropical_duplicate"+tropical_inc;
                       tropical_inc++;
                       tropical_mc.startDrag(false);
                      tropical_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load10") {
                       var waters_mc:waters_png=new waters_png();
                       addChild(waters_mc);
                       waters_mc.x=waters_mc.mouseX;
                       waters_mc.y=waters_mc.mouseY;
                       waters_mc.name="waters_duplicate"+waterthumb_inc;
                       waterthumb_inc++;
                       waters_mc.startDrag(false);
                      waters_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
    Please suggest me if any  one.
    Regards,
    Viji. S

    for each loader created, create a movieclip and add your loader to the movieclip.  assign all the properties you want to retrieve later to the movieclip and assign your event listeners to the movieclip.

  • Implicit coercion of a value of type flash.display:MovieClip to an unrelated type Class.

    These are my errors: in Adobe Flash CS5.5
    I don't understand why this script doesn't work. I am new to Action Script 3.0 and I watched this incomplete video on youtube. -- http://www.youtube.com/watch?v=LC7BaZCForE&feature=relmfu -- and I got the fails below.
    Scene 1, Layer 'actionscript', Frame 1, Line 11 1067: Implicit coercion of a value of type flash.display:MovieClip to an unrelated type Class.
    Scene 1, Layer 'actionscript', Frame 1, Line 11 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject.
    Main Timeline:
    import flash.filters.GlowFilter;
    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    var navBtnGlow:GlowFilter = new GlowFilter(0x999999, 0.5, 0, 15, 1, 2, true, false);
    navbar_jj.addEventListener(MouseEvent.MOUSE_OVER, navOverF);
    navbar_jj.addEventListener(MouseEvent.MOUSE_OUT, navOutF);
    function navOverF(event:MouseEvent):void{
         event.target.filters = [navBtnGlow];
    navbar_jj.setChildIndex(event.target as MovieClip(event.target), 1);
    dropmenus_jj.gotoAndStop(navbar_jj.getChildAt(1).name);
    trace("We are Rolled Over..." + navbar_jj.getChildAt(1).name)
    function navOutF(event:MouseEvent):void{
         event.target.filters = [];
    Clicker Drop Down
    import flash.events.MouseEvent;
    stop();
    leadersframe_btn.addEventListener(MouseEvent.MOUSE_OVER, goBackF);
    function goBackF(event:MouseEvent):void{
        gotoAndStop (1);

    Use:
    navbar_jj.setChildIndex(MovieClip(event.target), 1);
    Or
    navbar_jj.setChildIndex(DisplayObject(event.target), 1);

  • Event.target confusion?

    I'm trying to reusing function by using event.target, but after searching and trying different method online, I found the hardest part to understand is event.target part...
    can anyone please explain to me what is the difference between(the example on right showing where I encounter those code):
    1.event.target
    2.event.target.name
    3.event.currentTarget                             //e.g. event.currentTarget.addChild(myMc);
    4.event.currentTarget.name                    //e.g. var newswf:URLRequest= new URLRequest( event.target.name +".swf");
    5. MovieClip(event.currentTarget)            //e.g. addChild(MovieClip(event.currentTarget));

    I believe that Circle is extending MovieClip so it is MovieClip. The circle is many things, you just have to say the compiler which one you mean
    This is the inheritance of MovieClip:
    MovieClip  Sprite DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object
    The main culprit is the event.currentTarget property, which returns the safest option, Object. But it doesn't mean the circle becames only Object and nothing more, it means that the circle is just treated as just-an-object until you explicitly say "treat it as a MovieClip" by casting it as MovieClip: MovieClip(event.currentTarget).

  • Pausing Captivate 6 with a swf created in Flash Pro

    Not sure why my code isn't working but I've tried a few different things based on what's worked for other people. The code is placed on the frame where I need the interaction to pause. None of them appear to be working. I have a custom Flash interaction that the student needs to complete before continuing with the course.
    Here are the things I've tried:
    MovieClip(root).rdcmndPause = 1;
    var mainmov:MovieClip = MovieClip(root);
    mainmov.rdcmndPause = 1;
    var myRoot:MovieClip = MovieClip(root);
    var mainmov:MovieClip = MovieClip(myRoot.parent.root);
    mainmov.rdcmdPause = 1;
    FYI, I've tried both rdcmndPause and cpCmndPause for each of the above. Anyone have any ideas? Also, I'm getting ready to upgrade to Captivate 8. Have they made it any easier in that version to do this sort of thing?
    Thanks,
    Jeff

    in frame 1 of my fla source code, i used this var and event to interact with the captivate variables:
    var captivateVariables:*;
    addEventListener(Event.FRAME_CONSTRUCTED, isAdded);
    and then this function:
    function isAdded(e:Event){
      //txt.appendText("isAdded\n");
      removeEventListener(Event.FRAME_CONSTRUCTED, isAdded);
      try{
      captivateVariables = Object(parent.parent).getMovieProps().variablesHandle;
      //txt.appendText("captivateVariables: " + captivateVariables.cpCmndPause + "\n");
      catch(e:Error){
    and then i inserted it onto a captivate slide in frame 1.
    note: txt is a dynamic text area i put on the flash stage so i can see what was happening, since there is no trace statements coming from a running captivate file.

  • How can I control a button from one swf file to another swf file?

    Hi,
    I have a main.swf file. From that file I am accessing the external.swf file which is an external file.
    Now, how can I write code on my main.swf file for the button which is on my external.swf file?
    Activities.MainPanel.close_btn.addEventListener(MouseEvent.CLICK, btnClickClose);
    Activities.MainPanel.close_btn (This buttons is actually on external.swf file, but I want to write code on main.swf file to execute it on external.swf) how can I control one swf button on other swf file?
    Thanks.

    Here's some example code that you should be able to adapt to your needs.
    // create a new loader object instance...
    var loader:Loader = new Loader();
    // make the download request...
    var request:URLRequest = new URLRequest("external.swf");
    // add a complete event listener to the loader
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
    // start the actual loading process...
    loader.load(request);
    // create a new empty movieClip instance, you will put the loaded movie into this movieClip once its loaded
    var externalMovie:MovieClip;
    // this function is called when the download has finished and the file is ready to use...
    function completeHandler(event:Event):void {
       // set the contents of the loaded movie to the new empty movieClip...
               externalMovie = MovieClip(event.target.content);
       // add this new movie to the display list...
       addChild(externalMovie);
    Now you can refer to the loaded movie with the instance name "externalMovie". So if, for instance, you want to address a button in the loaded movie, you could write something like this on the main timeline:
    externalMovie.addEventListener(MouseEvent.CLICK, btnClickClose);
    function btnClickClose(event:MouseEvent):void {

Maybe you are looking for

  • Standard to follow for SSHR Pl/Sql report

    I wrote a web report for Oracle SSHR using the PL/SQL web tool kit. Is there any standard should i follow. Any SSHR packages has to be called in my package? thanks in advance Zameer

  • File Adapter errors!!!

    I am FTPing a file from a system within our firewall through XI. In Message monitoring the first part of the message (from unix to XI) fails after three retries.. But then somehow before the first retry attempt is kicked off, inbound message gets tri

  • Can a middle school student qualify for Apple's education discount

    I'm an 8th grader, going on high school soon, and I was wondering if a student in middle or high school can qualify for the Apple education discount?

  • I cannot lookup connection factory

    Hello! I try to run JMS with J2EE SDK. I started j2ee -verbose and I have written code as follows but I always get "javax.naming.CommunicationException: Can't find SerialContextProvider": Hashtable properties = new Hashtable(); properties.put(Context

  • Opening a doc in actual size

    Should be an easy question. I'm just not finding the answer too fast. Just got my new version of Elements and tried to open my file that is 36" x 24". Elements seems to default to opening the image in standard portait 8.5 x 11, grossly distorting the