AS3: How to target sub-MC of the loaded clip?

Hey everybody. I am new to AS3 and very... very lost (the last time I did a lot with flash was Flash 5).

Short version: I am trying to load external .swf from a URL and add event handlers for the video clips (or his film clips sub - MCs) on its stage. I can't find SOMETHING online about how to do it.

Details:

I have been instructed by my employer to build a control interface simple in flash with just a few buttons to make things like display some info or pictures or maybe a MP3 player. I wrote small test apps to do all of these individual things and managed to fake my way through.

But the sticking point, is now trying to put all the user interface controls in an external .swf, which I then load into the canvas by a URL. The goal is to be able to load it into a variable named, say, "private _ui:MovieClip" and then add event handlers to programme clips in this name as:

_ui.someButton1.addEventListener (MouseEvent.MOUSE_UP, handlerFunction1);
_ui.controlStrip.someButton2.addEventListener (MouseEvent.MOUSE_UP, handlerFunction2);

The goal is that if we want to Exchange on the user interface for a particular client, we just export a new .swf with all instances of correctly named MC & use the new URL to load the user interface.

I seem to be able to load the .swf OK and trace the film clips "Chronology of the hand" as follows:

_ui2.contentLoaderInfo.addEventListener (Event.COMPLETE, uiDidLoad);
function uiDidLoad(evt:Event) {}
trace ("UI2 LOAD");
{if (_ui2. Content)}
addChild (_ui2);
trace (_ui2. Content); -> [object MovieClip]
Target the "ControlStrip" named instance on the main timeline of the loaded .swf
trace (_ui2. Content.controlStrip); -> ERROR
}
}

Can someone point me in the right direction here? I spent hours don't make any progress on it. I think I've read half of the website of adobe so far. :-(

-Cliff

Quote:
Posted by: kglad
You must then mount this object like a MovieClip or the flash compiler is concerned.

I discovered this yesterday after a * lot * of trial and error. Everything seems to work correctly when you use:

LDR. Content as MovieClip;

I'm a little surprised that has not documented a little clear, but I guess it could be something that is obvious, if you ALSO know well enough. I'm trying to learn as much as I can because I go but you do not have my calendar does not really some time a lot of time for learning from the ground up.

Thank you.

Tags: Adobe Animate

Similar Questions

  • Determine the width of the loaded clip

    Hi all
    Is there a way I can get and set the width and height of a loaded clip? I created a movie then loaded and empty empty a small swf file in the film with loadClip. I now want to determine the width and height of the loaded clip and it adapts to the size of my movie dimensions. Is this possible? Although the film load fine and I can position its x and y coordinates, the width and height show as zero.

    Can someone help me with this one? I use Flash Professional 8.

    Thank you
    Brayne

    You must wait until loading is completed to access the loaded SWF _width and _height. and then you'll see the _width and _height of objects on stage in the first image if you access these properties as soon as the SWF is initialized.

  • GREP: How to target an appearance at the end of the paragraph?

    GREP newbie here. Trying to write a GREP expression that target a photo at the end of a caption of the photo credit and apply a character style.

    Text example:

    This is the caption of a picture and there is a legend over here (to the left). This is the caption of a picture and there is a legend here. (AP Photo/John Smith)

    The GREP expression should target the type of credit inside - and especially - the bracket. The trick: the term should target only a single occurrence at the end of the paragraph.

    Suggestions? That's what I have, what does not work. The expression applies the style to each occurrence of the type in parenthasis:

    \s\(.+\)$

    Any help appreciated.

    Basically, it prevents several parenthesis pick them up while seartching for a match.

    Ventilation GREP:

    \([^\)]+\)$
    
    \(    Literal opening parenthesis
    [^    Exclusion: any character not in this group
        \)    Literal closing parenthesis
    ]    End Exclusion Group
    +    While any character is NOT in this group may occur once or more times; longest possible match will be taken
    \)    Literal closing parenthesis
    $    End of Paragraph, Story, Footnote, or Cell
    

    Hope that helps.

    --

    Marijan (tomaxxi)

    http://tomaxxi.com

  • Flash AS3 how can I know what is the 'nth' character in a string?

    Hey,.

    I have a text input box, and I want to be able to know it was the 5th character inscription or the 3rd was registration.

    Something like that...

    var string1:String = input_txt.character1

    trace (string1)

    Hope you can help :)

    Thanks :)

    var someString:String = "Hello world here."

    trace (someString.charAt (5));

  • can you tell me how a 4 core processor distributes the load when windows 7 64-bit os is first turned on?

    can you tell me how a 4 core processor distributes window 7 64-bit os

    < thread="" was="" moved="" from="" feedback="" forum="" to="" windows="" performance="" and="" maintenance="" forum="">

    I tried to understand the links you sent me but they where to difficult for me to understand can you try to make it a little easier for me to understand, for example, when windows appears on the scren is using Basic 1 or 2 carrots etc.?

    Almost all past and current PC applications are only one processor/heart aware.

    Multi-threading...

    http://en.wikipedia.org/wiki/Multithreading _(computer_architecture)

    This may explain better...

    http://www.Intel.com/content/www/us/en/architecture-and-technology/Hyper-Threading/Hyper-Threading-technology.html

    And this...

    In order to use multiple cores, the Application must be written to do. A unique set of thread on a basic multi computer installed will cause only 1 core used by the game. There is an advantage that the BONE may assign other duties to the idle Lossnay. If the game can have the attention of 1 core. This isn't a bad thing and gives rise to real performance improvements. But because the game itself doesn't "understand" 1, then it will use only 1. It's him you use XP or Vista. Almost all past and current PC applications are only one processor/heart aware. This will change over time, for sure. But in many / most cases, it will require developers to write completely new applications.
    http://www.TomsHardware.com/Forum/246654-28-Windows-quad-core-processors

  • APEX dynamic action - how to hide an element after the loading of the page

    Hello

    I have a form with the element Type, lesson and page.   I want to create a dynamic as action ' on page load "If Type = x don't then see the lesson and the elements of the page. .

    How can I know if Type = x don't see the lesson and the page. It does not show them.

    Please note the dynamic, action = Page load event

    Thank you

    Try adding

    When the Condition "Javascript expression."

    Value: $v ('P1_TYPE') == 'x')

  • How can access a button inside the video clip

    I have a button named a_btn. This button is located in a clip name a_mc passage. This button is on the first frame. then when you write the code for that:

    function submit(event:MouseEvent):void

    {

    trace ("hii")

    }

    a_mc.a_btn.addEventListener (MouseEvent.Click, Submit);

    his work. but when I keep this button on 2nd chassis or anywhere not in 1 frame inside that movie clip, then I get error runtime as:
    TypeError: Error #1009: cannot access a property or method of a null object reference.
    to NewFlashDocument_fla::MainTimeline / NewFlashDocument_fla::frame1 ().
    How can I access this button on the second picture...

    You cannot reference an object until there are.  Thus, if a_btn is on the 2nd frame of a_mc, you must wait until this 2nd frame plays before trying to refer to a_mc.a_btn.

    If not, put a_btn on the first image and set its visible property to false in the first frame and true as part of the 2nd.  Then you can use your current code and duplicate the design you are trying to achieve by moving the button on the 2nd frame.

  • How to export an image from the video clip of the first Pro to Photoshop for corrections and back.

    I want to export a video clip in Premier Pro on Photoshop for minor corrections throughout, then back to the first Pro. Corrections will be the same for each frame in the video. What is the best way to achieve this? If it makes any difference, I work with clips of R3D monochrome 6 K.

    Hi TR.

    Try to import the file directly in Photoshop. If this does not work, report.

    Thank you
    Kevin

  • How to 'Allow smoothing' for the loaded XML .jpg?

    I have a thumb wheel image that loads a bunch of jpg. They are be enlarged rollover in 1,05.

    I've seen pixelated at scale 1 x 1 as well as expanded.

    I'm happy prettey how Flash renders the images with "Allow smoothing" on.

    How would I do it for the loaded xml jpg? Would it be as a script in the main folder or in the xml file?

    Here's how to load images in AS3:

    function completeHandler_AppPopUps(e:Event):void{
              //trace("thumbnail complete "+e.target.loader.parent.parent.name)//tells us when the loading is complete
    
              //size image into scroller (need only if I will have images at different sizes)
              resizeMe(e.target.loader.parent, 60, 90, true, true, false);
    
              TweenMax.to(e.target.loader.parent.parent, .5, {alpha:.7});//makes all thumb images at alpha=.7 after they are fully loaded
              //Tweener.addTween(e.target.loader.parent.parent, { alpha:1, time: .5 } );//caurina version
    
              TweenMax.to(e.target.loader.parent.parent, .5, {colorMatrixFilter:{contrast:1.1, brightness: .7, saturation: .5}});//makes all thumb images at brightness:0.5 after they are fully loaded
    
    
    }
    
    

    I don't want to complicate things more than necessary, but just in case it's needed here is the complete code for the edification of the wheel section:

    /////Parse XML
    //build scroller from xml
    function buildScroller(imageList:XMLList):void{
              trace("build Scroller");
    
              for (var item:uint = 0; item<imageList.length();item++) {
                        var thisOne:MovieClip = new MovieClip();
    
                        //outline
                         var blackBox:Sprite = new Sprite();
                        blackBox.graphics.beginFill(0xFFFFFF);
                        blackBox.graphics.drawRect(-1, -1, 62, 92);//-1,-1 places rectangle 1px left and up.62, 92 draws rectangle 1px wider on all sides of placed image dimenstions of 60x90
                        blackBox.alpha = thumbFadeOut;//setting Border Tweens
                        thisOne.addChild(blackBox);
                        thisOne.blackBox = blackBox;//setting Border Tweens
    
                          thisOne.x = thisOne.myx = (60 + padding) *item;//replaces the line above for scale tweenw roll over calculation. "myx" is a made up term which defines the position. 61 is the width of the thumb
                        thisOne.itemNum = item;
                        thisOne.title = imageList[item].attribute("title");
                        thisOne.link = imageList[item].attribute("url");
                        thisOne.src = imageList[item].attribute("src");
                        thisOne.alpha = 0;//makes all thumb images at alpha=0 before they are fully loaded
    
                        //Loading and Adding the Images
                        //image container
                        var thisThumb:MovieClip = new MovieClip();
                        //add image
                        var ldr:Loader = new Loader();
                        //var url:String = imageList[item].attribute("src");
                        var urlReq:URLRequest = new URLRequest(thisOne.src);
                        trace("loading thumbnail "+item+" into Scroller: " + thisOne.src);//url
                        ldr.load(urlReq);
                        //assign event listeners for Loader
                        ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler_AppPopUps);//tells us when the loading is complete
                        ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler_AppPopUps);//tells us if there are any typo errors when the loading is complete
                        thisThumb.addChild(ldr);
                        thisOne.addChild(thisThumb);
    
                        //create listeners for this thumb
                        thisOne.buttonMode = true;//makes boxes act as buttons
                        thisOne.addEventListener(MouseEvent.CLICK, clickScrollerItem_AppPopUps);//makes boxes act as buttons
                        thisOne.addEventListener(MouseEvent.MOUSE_OVER, overScrollerItem_AppPopUps);//traces the title when the mouse is over the bounding box in the Output Panel
                        thisOne.addEventListener(MouseEvent.MOUSE_OUT, outScrollerItem_AppPopUps);//traces the title when the mouse is out the bounding box in the Output Panel
    
    
    
                        //add item
                        scroller.addChild(thisOne);
              }
              scroller.addEventListener(Event.ENTER_FRAME, moveScrollerThumbs);//adding movement on mouse position
              trace("termination of build scroller");
    
    }
    
    
    

    in your listener to full charge, enable the property smoothing to the content of your charger (expressed as a bitmap).

    function completeHandler_AppPopUps(e:Event):void{

    Bitmap(e.currentTarget.loader.content).smoothing=true;
              //trace("thumbnail complete "+e.target.loader.parent.parent.name)//tells us when the loading is complete

    //size image into scroller (need only if I will have images at different sizes)
              resizeMe(e.target.loader.parent, 60, 90, true, true, false);

    TweenMax.to(e.target.loader.parent.parent, .5, {alpha:.7});//makes all thumb images at alpha=.7 after they are fully loaded
              //Tweener.addTween(e.target.loader.parent.parent, { alpha:1, time: .5 } );//caurina version

    TweenMax.to(e.target.loader.parent.parent, .5, {colorMatrixFilter:{contrast:1.1, brightness: .7, saturation: .5}});//makes all thumb images at brightness:0.5 after they are fully loaded

    }

  • How can I remove a non-existent target ESX server from the list of vMA?

    I added some ESX servers at VMAs using "lt & sudo vifp addserver; hostname & gt; ».  These servers have been removed before removing the VMA.  Since they are not online, I get the message when you do "sudo vifp removeserver & lt; hostname & gt; "below.  How can I remove them from the list of targets vMA?  Thank you.

    Error: Unable to connect. Please make sure that the server is in place and is a supported version.

    If you are using the latest version of vMA 4.0, you should be able to do the following:

    sudo vifp removeserver  --force
    

    When it ask for password, just type in whatever she should remove just with strength of the management host.

    You can also take a look in the vMA configuration file that keeps track of hosts under management and erase the old entries:

    / etc/VMware/viconfig/viconfig. XML

    / Home/VI-admin /. VMware/credstore/vicredentials. XML

    Who gives a try and see if it helps, it is always advisable to withdraw before the host decommission but option 1 work usually, from what I've seen.

    =========================================================================

    William Lam

    VMware vExpert 2009,2010

    VMware scripts and resources at: http://www.virtuallyghetto.com/

    Twitter: @lamw

    repository scripts vGhetto

    Introduction to the vMA (tips/tricks)

    Getting started with vSphere SDK for Perl

    VMware Code Central - Scripts/code samples for developers and administrators

    VMware developer community

    If you find this information useful, please give points to "correct" or "useful".

  • How to target the buttons that are nested by 2 levels and one more thing...

    OK I'm going.  The link below, this is what I deal with

    http://clienttestsite.X10.MX/beta/garage.swf

    The garage door has a chevrolet logo that is thrilling. I know not how to make buttons but I need the garage door to become a button when you click on the animation plays instead of playing automatically.

    The upper part of the chest of the tool will be a button that plays the animation backwards and the drawers are the buttons that open to an e-mail for each form.  But I do not know how to target those buttons because they are nested two levels below the main timeline.

    In the case where he changes the way to proceed, once completed this film will be imported in another.

    Help, please!

    Thanks in advance.

    As long as the object that you want to make clickable is an object with an instance name (movieclip, button, etc.) you can make it work like a button.  If you know how the code for the buttons, then this should be everything you need to know to make the garage door a clickable object.

    Target buttons that are nested you can use the point rating to target... Since you did not identify the details of nesting, here's how it goes mainly...

    Toolchest.Drawers.drawer1.addEventListener(...etc)

  • How to have an entry in the list 'No. Target' parent not 'clickable '?

    I use DHTML tree as my list template and the list is added to the zero page in the Navigation area model. All entries in the child list are working properly and the parent entry list is set to "No Target". However, when I mouse over the parent entry list, the list of entries parent stills show that there is a clickable link, even if it does nothing if I click on it. It is misleading. If it is a 'feature', is anyway do disable it or bypass it?

    A better way to disable the link of the parent list item is to choose the "target Type" = "URL" and "The target URL =" #" When the user clicks on the parent list element, the browser would simply navigate to the top of the web page itself. In other words, he would just stay on the same web page, and there is not even a page refresh must be executed.

  • AS3 how to programmatically a call for an image contained in the library

    I work with a UILoader, and I will he have to display images; but the images must be in the library to reduce the size of the overall content. So I have to somehow refer to images in the library of code. How can I do?

    The following code would work?

    var photoURLReq:URLRequest = new URLRequest(photo1:Photo1InLibrary);
    loader_mc. Load (photoURLReq);

    or

    var photo1:Photo1InLibrary = new Photo1InLibrary();
    loader_mc. Load (PHOTO1);


    All this work code would be?

    In fact he's a bit more complicated than that because an image is the BitmapData class... If Img is the class name assigned to the image in the library...

    var img:Img = new Img (1,1);
    var bitmap: Bitmap = new Bitmap (img);
    addChild (bitmap);

  • How can I insert images in the submenus in the navigation bar?

    You guys,.

    I wonder how the submenus in the navigation bar of the site Internet was done. Anyone know how I can add images in the form of sub menus? Here is the site: http://cliffsliving.com/

    Thanks a bunch

    Hello

    You can do this by using Tooltip composition in the library of Widgets under 'Compositions '.

    You must review and design trigger in the top menu and the target than the submenus, and you can add the text and pictures in there.

    Concerning

    Vivek

  • AS3: How to access and control embedded sounds in an external swf?

    I rarely use the sounds in AS3/Flash. I use Flash Pro CS6, but I can't seem to understand how access control (play, stop, etc) sounds embedded in a SWF external loading in the main SWF file.

    It is easy to control them when they are incorporated on the main swf. However, on a responsible external SWR, I get all sorts of errors. For this application, I really need to incorporate in the external SWF file.

    I've read several solutions, but none seems not to work.

    I integrate the sound file mp3 called soundSegment1.mp3 tool to import Flash CS6 and then open the properties panel actionscript Flash select the name of the class: SoundSegment1. Can I change the class ID and create a file named SoundSegment1.as, and it saved right next to my document class main.as in the same directory. The code for the SoundSegment1 class looks like this:

    package  {

       
    import flash.media.*;


       
    public class SoundSegment1 extends Sound
       
    {

           
    public function SoundSegment1 ()
           
    {
               
    // no code in here
           
    }


           
    public function playSound()
           
    {
               
    var soundSegment1:Sound = new SoundSegment1();
               
    var channel:SoundChannel = soundSegment1.play();
           
    }
       
    }
    }

    Then, in my main.as, I made several attempts to play this sound such as:

    var fileLocation:URLRequest = new URLRequest(SWFToLoad);

    loader.load(fileLocation);

    loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);

    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeListener);

    loader.contentLoaderInfo.addEventListener(Event.INIT, initListener); 


    function initListener(e:Event):void // I also placed this code on the completeListener and it didn't work

    {

         loader.content.soundSegment1.playSound(); // doesn't work. 

    }

    I get:

    Line XXX 1061: Call to a possibly undefined method playSound through a reference with static type flash.display:DisplayObject.

    Otherwise, I also read that I should be able to do something like this anywhere in the Main.as file:

    var theClass:Class = Class(loader.content.getDefinitionByName("SoundSegment1")); var theSound:theClass = new theClass(); theSound.play()  //doesn't work either.

    I also tried on the completeListener:

    var TheClass:Class = e.target.applicationDomain.getDefinition("SoundSegment1") as Class;

    var theSound:TheClass = new TheClass();
    theSound
    .play()  //doesn't work either.

    I get:

    ReferenceError: Error #1065: Variable SoundSegment1 is not defined. at flash.system::ApplicationDomain/getDefinition()

    I'm stuck and I really need this to work. I would really appreciate your help.

    Thanks in advance for any help provided. I really need to make it work, because I can not simply incorporate into the main SWF or load them individually outside one by one.

    Thanks again!


    You can use the load and loadCompleteF below:

    var SWFToLoad: String =...;

    var s:String = "SoundSegment1";

    Load (SWFToLoad, s);

    function load (urlS:String, classS:String) {}

    var ldr:Loader = new Loader();

    ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, function(e:Event){loadCompleteF(e,classS);});)

    LDR. Load (new URLRequest (URL));

    }

    function loadCompleteF(e:Event,classS:String):void {}

    var loadedAppDomain:ApplicationDomain = e.target.content.loaderInfo.applicationDomain;

    var C: Class = loadedAppDomain.getDefinition (classS) in class;

    var instance: * = new C();

    Sound (instance). Play();

    }

Maybe you are looking for

  • Defective GarageBand after update to iOS 9.2 on iPad3

    Since I have updated to iOS 9.2 on my iPad 3 I was not able to read or save on GarageBand.  When I try to save a climax using my microphone, I hear a cracking sound.  I contacted peak about a week ago and have no solutions of their own.  Today, I tho

  • draw the table using report generation tools

  • T61p: External speakers won't talk...

    I have a strong suspicion that this may well be a silly question but guess I have to swallow... I need help for my external speakers for laptop reactivation of Logitech V10. Let me give a bit of history: These speakers do not use a laptop computer's

  • Under MSCONFIG system configuration

    Hello I was checking the CONFIGURATION of my SYSTEM under msconfig.exe and I noticed that my startup was not established for a normal startup but on the selective startup with LOAD SYSTEM SERVICES checked (on). My laptop (ENVY 17 1190 ca windows 7 64

  • Want a warning before hibernation, so I can connect (Vista)

    I finally got Hibernate to work so that the computer into hibernation with success until the battery drops below 10%.  In previous versions of Windows, we would get a warning message to a greater percentage of the battery so that we can grasp the plu