MovieClip coding questions

I'm a few days only in Flash 8, and I'm a little confused about conceptually what 'Clips' should be and was hoping to get some quick answers:

(1) I was looking through the code example and it looks that they create new graphic elements through this.attachMovie (), and I'm not sure what 'this' is because the code is simply written in the Panel in frame 1 actions. (I know what "it" means to a point of view programming;) I don't know what scope the code object that runs there). Object I'm 'in' in the code that is just sitting at frame 1 of the main timeline of scene?

(2) it says that I have a MovieClip subclass, which is what I want to do to make little animation of controllable characters (e.g. "class car extends MovieClip", but I don't understand how the instantiate in actionscript.) According to the docs, you do not use the constructor methods do MovieClips, but instead use createEmptyMovieClip(), attachMovie() or duplicateMovieClip(). So, how to make an object of class car? attachMovie() returns a MovieClip, and I can't get that to a class of the car.

(3) just curious to see how the inhabitants generally organize their code (and symbols) with respect to MovieClips, in the case of say a moving car in a game application. MovieClips tend to represent simple animations (e.g. a MovieClip of a car with the wheels turning on the left, where the wheels turn to the right, where it breaks down, and they are created and destroyed every time that changes state of the car)? or simple objects (for example a MovieClip containing several short animations along the timeline: a left roll, a right, a crash, with the labels and the action scripts of "goto" to the animation of the loop, etc.)?

(4) what is the purpose of empty clips? People use them as I would use a transform in Maya node or null in Lightwave (e.g. just a pivot to the transformations battery?)?


Thanks and forgive the screen name - I had some questions by choosing a screen with Firefox name and tried a test of gibberish in IE and oops, it worked, and I can't understand how to change it for a real screen name. So apparently I'm stuck as 'asdfhabsaf '.

--
Ken

1. the main scenario is itself a MovieClip. Yes, 'this' on the main timeline
refers to the main timeline... It suppresses simply ambiguity.

2. in the library, right click the movieClip and select the link. It you
Click on "Export for ActionScript" and the class field will become available.
This is where you put a reference to your class.

3. really depends on you and the needs of the projects.

4 empty clips are useful for the place holders, to load external content.
And Yes, a bit like Maya... you can load multiple clips in a clip,
and then move all the clips by dragging one of the parents.

--
Dave-
Developer leader
http://www.blurredistinction.com
Adobe Community Expert
http://www.Adobe.com/communities/experts/

Tags: Adobe Animate

Similar Questions

  • CFIF / CFELSE coding Question

    I'm not very proficient in ColdFusion, but can usually get in. However, we have added a third option of membership category, and I can't seem to get the code to work properly. Here's what we do:

    There are 3 categories to choose: Growing Company, investors and professionals. As a growth company, there are 3 levels to choose (there were only 2). For investors and professionals, it is a single level.

    Here's the current, broken code. We find that people who try to join the $255 level or $695 team are the TWO categories of see - they are getting confused about what they are signing for.

    < CFIF #memberCategory # IS "companyMember" >
    < CFIF #memberType # IS "growingTeam" >


    Member category: < b > contractor & amp; Management team, team members - $695 < /b >
    < / CFIF >

    < CFIF #memberType # IS "growingSingle" >
    Member category: < b > contractor & amp; Unique membership management team - $495 < /b >
    < CFELSE >
    Member category: < b > contractor & amp; Management team, contractor 2011 - $255 < /b >


    < / CFIF >

    < CFELSEIF #memberCategory # IS "investorMember" >
    Member category: < b > investor - $495 < /b >

    < CFELSE >
    Member category: < b > Professional - $895 < /b >

    < / CFIF >

    Before adding this new level of $255, everything worked fine. Does anyone have a solution?

    Your help is greatly appreciated. Thank you!

    Tonya

    You may have been lucky.  I am curious and plays with it.

    -What are you trying to do?

    
        
            Membership Category: Entrepreneur & Management Team, Team Membership - $695
        
            Membership Category: Entrepreneur & Management Team, Single Membership - $495
        
            Membership Category: Entrepreneur & Management Team, 2011 Entrepreneur - $255
        
    
        Membership Category: Investor - $495
    
        Membership Category: Professional - $895
    
    

    You can see how good spacing can help unravel the logic.

  • Event (interpolation) coding question

    It was a little beyond me to start, but I'm quite happy how I did.  I am loading an XML file with a series of photos.  Photos scroll on a timer of three seconds approximately.  Load images with an alpha of 0 and there is a Tween them fade.  The problem I have is trying to interpolate that réécrirait them a value of 0.  I'm a little Eyed so any help would be appreciated.

    (My fadeOut function fires never (no sign))

    Here is the code:

    Import fl.transitions.Tween;
    Fl.transitions.easing import. *;
    Import fl.transitions.TweenEvent;
    var myTween:Tween;

    var xmlRequest:URLRequest = new URLRequest ("imageData.xml");
    var xmlLoader:URLLoader = new URLLoader (xmlRequest);
    var imgData:XML;
    var imageLoader:Loader;
    var rawImage:String;
    var rawH:String;
    var rawW:String;

    var imgNum:Number = 0;
    var checkSec:Timer = new Timer (100);
    var: delay timer = new Timer (5000);
    var numberOfChildren:Number;


    xmlLoader.addEventListener (Event.COMPLETE, xmlLoadedF);
    delay.addEventListener (TimerEvent.TIMER, nextImgF);
    Delay.Start ();

    function xmlLoadedF(event:Event):void {}
    checkSec.start ();
    checkSec.addEventListener (TimerEvent.TIMER, checkerF);
    imgData = new XML (event.target.data);
    }


    function packagedF (): void {}
    checkSec.removeEventListener (TimerEvent.TIMER, checkerF);
    rawImage = imgData.image [imgNum] .imgURL;
    numberOfChildren = imgData.*.length ();
    rawW = imgData.image [imgNum] .imgW;
    Sweet = imgData.image [imgNum] .imgH;
    imageLoader = new Loader;
    imageLoader.load (new URLRequest (rawImage));
    master_mc. AddChild (imageloader);
    imageLoader.x = (stage.stageWidth - Number (rawW)) / 2;
    imageLoader.y = (stage.stageHeight - Number (sweet)) / 2;
    imageLoader.alpha = 0;
    myTween = new Tween (imageLoader, "alpha", Strong.easeOut, imageLoader.alpha, 1, 4, true);
    imageLoader.addEventListener (TweenEvent.MOTION_FINISH, fadeOut);

    }

    function checkerF(event:TimerEvent):void {}
    if(imgNum == 0) {}
    packagedF();
    } else if(imgNum < numberOfChildren) {}
    imageLoader.addEventListener (TweenEvent.MOTION_FINISH, fadeOut);
    imageLoader.unload ();
    packagedF();
    } else {}
    imageLoader.unload ();
    imgNum = 0;
    packagedF();
    }
    }

    function nextImgF(event:TimerEvent): void {}
    checkSec.addEventListener (TimerEvent.TIMER, checkerF);
    imgNum ++;
    }

    function fadeOut(e:Event):void {}
    imageLoader.alpha = 1;
    myTween = new Tween (imageLoader, "alpha", Strong.easeOut, imageLoader.alpha, 0, 4, true);
    trace ("Click");
    }

    You want to add the listener to tween to the tween instance, not the object which is interpolated.

    myTween.addEventListener (TweenEvent.MOTION_FINISH, fadeOut);

  • Google game - market and shortcut question

    Just got the update, Google playing today and now the market shortcut at the top of the app drawer doesn't work anymore. I think it's probably some sort of coding question market name has changed, but I wanted to just report.


  • -CS4 encoding - quiz

    I'm a guy questions and answers game coding for a class of mine. Even thought I have CS4, I use ActionScript 2.0. The game has five categories. Each category has a button in stage II which takes the reader to another scene (button A for stage III, the B button for stage IV, etc.). Once you get to the scene, a box (made a button so you can click on it) with a question fades. When you click it, the question vanished and the answer turns off. He recliquant loops around the beginning of the interpolation of discoloration.

    I need help is to find a way to ensure that whenever the player clicks on a category, they will be brought to the question online. For the first time, the player clicks on A category, they will be redirected to 1A Question/answer. The second time they click on A category, they will be redirected to answers 2A. And so on and so forth.

    Also, is it possible to simply do it without having to do each individual question/answer button? I have over 100 questions and I do not know how well my program will work with a lot of things to load.

    You need to rethink your approach to simplify this game.  Using scenes as you are, it will be difficult to manage and using scenes with navigation is not a reliable design approach when it comes to Flash, they do not work reliably.  You can easly design all this is just a picture if the timeline if you think that through it.

    Your game design doesn't have to rely on the creation of movieclips individual questions and answers you have to manage in the timeline.  What you should think of is to know how to go about making it so that your questions and your answers are just data that you store in variables (like a table).  You just pull the data in the order of the array as you progress in the game.  Later, you may have questions/Berry introduced into the file dynamically using an xml file or a database.

    The vehicle for the presentation of the question / answer games may be designed as a movieclip with a dynamic textfield that you assign the text for each new question / answer the use of code.  Try to think about how design a movieclip that does everything that you call as much as the buttons and whatnot that you can use again and again, just a case of it.  Go you through a question / answer set, click a button and this same movieclip is reused, where the next question / response replace the latter.

    It might seem like a work of lotta, even just to learn how do, but I'd be willing to bet that it will take much less time to do than create the way you now take place maybe 10 or 20 questions.

  • How to change the Javascript code to make an exception for a single read command?

    Hello


    I posted a question earlier in another sub-forum and found this script that makes the form read-only fields. Now, I have a particular coding question.


    First of all, here's the code:

    var r = app.alert("Are you ready to lock this document?",2,2);
    if (r == 4) { // 4 is Yes, 3 is No
      
    for (var i = 0; i < this.numFields; i++) {
      
    var fname = this.getNthFieldName(i);
      
    this.getField(fname).readonly = true; // makes all fields readonly
      
    }
    }

    On the bottom of my form, I have a button that allows you to set the read-only form, but I also have other keys such as "print". How do I change the code above to make an exception for the command of read-only for my buttons so that they are still functional at the bottom of my form? I don't know anything about Javascript then this is a foreign language for me.

    Any help is appreciated!

    If (f.name == "FieldNameToExclude") continue;

  • phone and Tablet width is smaller when uploaded to ftp: and yet it works fine on the catalyst?

    The layout seems to be about 60% of the required width (left range).

    I downloaded with the native FTP of Muse and manually in HTML with FileZilla and Fetch all with the same result.

    I checked that it is not all the objects to the right offshore in fact virtually rebuilt the size several times.

    Built originally on the default settings, I have rebuilt the page 640 width (width in pixels iPhone) and always got the same result.

    Everything was perfect seen on my site of catalyst on all platforms.

    Help, please

    Thanks for your help, Nicolas.

    With Reg123, I managed to solve the problem:

    Rather than any coding questions or coding devices within the downloaded site redirection, the problem was with the global site forwarding.

    I put overall site through the "Preview" URL redirection

    http://94.136.40.103/~forkscafe.org.UK

    This can be done with the control panel 123 Reg - "Managing DNS (domain advanced settings)".

    He has set the aesthetic issues. This means that the url bar shows the number rather than the name of the url... but hey, at least the site looks right. I hope this thread helps someone else along the way

    See you soon

    Nick

  • Error 1120 problem

    I get an Error 1120 on inclusion scipr called scrolling_image.as and I don't know why.  As you can see I'm trying to put all the pieces of this script in a function that will be called when a button is clicked it load the appropriate information in the file xmil and show the correct images in scrolling. Anyone have any ideas why I get the error?

    The main script is:

    import flash.events.MouseEvent;

    import flash.display.MovieClip;

    Caurina.transitions import. *;

    Initialize Variables

    var organName:String = "";

    var speed: Number;

    var padding: Number = 20;

    var thumbFadeOut:Number is. 2;

    var thumbFadeIn:Number = 1;

    var thumbSmall:Number = 1;

    var thumbLarge:Number = 1.1;

    Files included

    include "/ AS/buttonScripts.as.

    include "/ AS/scrolling_image.as.

    buttonScripts.as

    function LoadXML(e:Event):void

    {

    trace ("xml loading complete");

    //load xml

    var xmlLoader:URLLoader = new URLLoader();

    var xmlData:XML = new XML();

    var xmlPath:String = "XML/organtext.xml";

    xmlLoader.load (new URLRequest (xmlPath));

    trace ("loading xml from:" + xmlPath);

    xmlData = new XML (e.target.data);

    trace (xmlData.organ. ((@ name) == organName).visualAids.image);

    var scroller: MovieClip = new MovieClip();

    questions.addChild (scroller);

    = scroller.y scroller.x = padding;

    buildScroller (xmlData.organ. ((@ name) == organName).visualAids.image);

    textImport (xmlData.organ. ((@ name) == organName) .name);

    }

    XML text

    function textImport(imageList:XMLList):void

    {

    trace (xmlData.organ. ((@ name) == organName) .descriptions)

    questions.headers.text = xmlData.organ. (@name == organName) .name

    questions.topictext.text = xmlData.organ. (@name == organName) .descriptions

    }

    / * var speed: Number;

    var padding: Number = 20;

    var thumbFadeOut:Number is. 2;

    var thumbFadeIn:Number = 1;

    var thumbSmall:Number = 1;

    var thumbLarge:Number = 1.1; * /

    var scroller: MovieClip = new MovieClip();

    questions.addChild (scroller);

    scroller.x = scroller.y = padding;

    build the scrolling of a xml file

    function buildScroller(imageList:XMLList):void

    {

    trace ("' generation Scroller '");

    for (var point: uint = 0; point < imageList.length (); point ++)

    {

    var thisOne:MovieClip = new MovieClip();

    //outline

    var blackBox:Sprite = new Sprite();

    blackBox.graphics.beginFill (0xFFFFFF);

    blackBox.graphics.drawRect (-1, -1, 142, 107);

    blackBox.alpha = thumbFadeOut;

    thisOne.addChild (blackBox);

    thisOne.blackBox = blackBox;

    thisOne.y = thisOne.myy = (140 + padding) * point;

    thisOne.itemNum = item;

    thisOne.title = [item] imageList .attribute ("title");

    thisOne.link = [item] imageList .attribute ('url');

    thisOne.src = [item] imageList .attribute ("src");

    //image container

    var thisThumb:Sprite = new Sprite();

    //add image

    var ldr:Loader = new Loader();

    var urlReq:URLRequest = new URLRequest (thisOne.src);

    trace ("thumbnail loading" + item + "in Scroller:" + thisOne.src);

    ldr.load (urlReq);

    //assign for loader event listeners

    ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, completeHandler);

    ldr.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR, errorHandler);

    thisThumb.addChild (ldr);

    thisOne.addChild (thisThumb);

    //create headphones for that inch.

    thisOne.buttonMode = true;

    thisOne.addEventListener (MouseEvent.MOUSE_OVER, overScrollerItem);

    thisOne.addEventListener (MouseEvent.MOUSE_OUT, outScrollerItem);

    thisOne.addEventListener (MouseEvent.CLICK, clickScrollerItem);

    //add point;

    scroller.addChild (thisOne);

    }

    scroller.addEventListener (Event.ENTER_FRAME, moveScrollerThumbs);

    trace ("termination of construction scroller");

    }

    function overScrollerItem(e:MouseEvent):void

    {

    //trace ("over" + e.currentTarget.name);

    Tweener.addTween (e.currentTarget, {scaleY: thumbLarge, scaleX:thumbLarge, y: e.currentTarget.myy - e.currentTarget.height * Math.abs(thumbSmall-thumbLarge)/2, x - e.currentTarget.height * Math.abs(thumbSmall-thumbLarge)/2, time: 1});

    Tweener.addTween (e.currentTarget.blackBox, {alpha: thumbFadeIn, time: 1});

    }

    function outScrollerItem(e:MouseEvent):void

    {

    //trace ("out" + e.currentTarget.name);

    Tweener.addTween (e.currentTarget, {scaleY: thumbSmall, scaleY: thumbSmall, y: e.currentTarget.myy, x: 0, time: 1});

    Tweener.addTween (e.currentTarget.blackBox, {alpha: thumbFadeOut, time: 1});

    }

    function clickScrollerItem(e:MouseEvent):void

    {

    //trace ("item clicked" + e.currentTarget.itemNum + "-visit url:" + e.currentTarget.link);

    var urlRequest:URLRequest = new URLRequest (e.currentTarget.link);

    try

    {

    navigateToURL (urlRequest);

    }

    catch (error)

    {

    / / handle the error here

    trace (e);

    }

    }

    function completeHandler(e:Event):void

    {

    //trace ("thumbnail full" + e.target.loader.parent.parent.name);

    //size image scroller

    resizeMe (e.target.loader.parent, 140, 105, true, true, false);

    Tweener.addTween (e.target.loader.parent.parent, {alpha: 1, time:.5});})

    }

    function errorHandler(e:IOErrorEvent):void

    {

    trace ("thumbnail error =" + e);

    }

    function resizeMe(mc:DisplayObject,_maxW:Number,_maxH:Number=0,_constrainProportions:Boolean=true,_centerHor:Boolean=true,_centerVert:Boolean=true):void

    {

    maxH = maxH == 0? maxW:maxH;

    mc.width = maxW;

    mc.height = maxH;

    if (constrainProportions)

    {

    mc.scaleX < mc.scaleY? mc.scaleY = mc.scaleX:mc.scaleX = mc.scaleY;

    }

    if (centerHor)

    {

    mc.x = (maxW - mc.width) / 2;

    }

    if (centerVert)

    {

    mc.y = (maxH - mc.height) / 2;

    }

    }

    function moveScrollerThumbs(e:Event):void

    {

    if (mouseX > scroller.x & & mouseX < scroller.x + scroller.width)

    {//vertically on scroller

    if (mouseY < stage.stageHeight/2 - padding * 2 & & mouseY > 0)

    {//left scene explicitly

    speed =-(mouseY-(stage.stageHeight/2-rembourrage * 2)) / 8;

    }

    ElseIf (mouseY > stage.stageHeight/2 + padding * 2 & & mouseY < stage.stageHeight)

    {//right scene explicitly

    speed =-(mouseY-(stage.stageHeight/2 + rembourrage * 2)) / 8;

    }

    else

    {

    speed = 0;

    }

    scroller.y += speed;

    //scroller limits

    if (scroller.y < - scroller.height + stage.stageHeight - padding)

    {//if scrolls too far to left

    scroller.y = - scroller.height + stage.stageHeight - material upholstery;

    }

    combination else if (scroller.y > padding)

    {//if scrolls to the right

    scroller.y = padding;

    }

    }

    }

    I can't say your code which is what line, but based on your definition of the inisde variable xmlData a function, if you try to access anywhere outside this function, it does not exist outside the function.  Try to declare the variable outside of any function to give it a more global scope.

  • Tween alpha works fine in preview, but not in the swf file

    I was wondering if anyone could offer some suggestions. I have a few words written in text mode static I made a graphic symbol. On the timeline, I used the motion tween and classic Tween to create change aplha from 0% to 100%.  I made sure that I have enoough to space on my calendar (10 images).

    Aplha interpolation works fine in preview, however when I export the swf file the aplha interpolation doesn't work anymore? I tried to break the text, flash of reboot, restart my computer and similar proposals for other items such as:

    I was able to fix this by checking the box 'use bitmap caching DURATION' in Blend in the properties panel for the MovieClip in question.

    I am currently using Flash CS5 on an imac. Would be grateful for any suggestions, that I do not understand how something that worked very well, has suddenly stopped working? Bug?

    Thanks in advance

    Stace

    Create a new fla and duplicate your efforts with your tween alpha of your text.  any problem?

  • DropShadowFilter on Air for Android

    Hi all

    Is there a known issue with the publication of air for android applications that use filters (DropShadowFilter, BlurFilter)? As when I try the publication of my phone, the movieclips in question do not even at the scene, which is strange because they work fine when I preview them as a SWF on my computer. I tried to apply the filters in the library of CS5, and make using the code in my document classes and doesn't seem to work! Of course, I tried with cacheAsBitmap (Matrix) on and outside as well.

    Just wondering if its something which is not supported? Or if there is a way around it?

    Thank you.

    Check you renderMode value 'cpu?

    Filters and 'gpu' play together at all, I think.

  • Drawing 3d objects

    I'm busy on a development of AP plugin. The main problem with this plugin to draw a simple 3d object (such as a cube). How can I use the API to draw simple 3d objects, or perhaps at least primitive 2d (lines)? It will be better if you provide ways to draw in the main Editor window, or perhaps in another window. Please answer me as soon as you can, for this reason it is very important for me.

    You can ask this question in the wrong forum, this is a C/C++ coding question.

    A simple example of a line in a window frame Freehand / encoding can be found and downloaded from the link given below:

    http://msdn.Microsoft.com/en-us/library/aa716527 (VS.60) .aspx

    To make any example work in prepro CS3 or whatever, you need to incorporate your own code in an example of Adobe provided in their SDK as you will be well aware. This could then be compiled in an IDE such as MS Visual Studio.

    John

  • Can someone help me understand this very simple script please?

    I have a simple coding question that frustrates the heck out of me. . Basically, the script below moves button_mc. 100 px when you click top then down to 100px when you click it again. I know that the simple script below works but I do not know why

    It seems that his say if the variable 'jumping' is 'true' move "button_mc" up to 100 px. "The part I do not understand why ' button_mc" move down to 100 px to second click.

    seems to me that it ignores this first function, because 'Skip = false' run the second function and moves to the top of 100px. Then why in the second click it move down? wouldn t it theoretically just skip the first part of the function again?

    I hope this makes sense and someone can help me.

    I'm so frustrated!

    Thank you!!!

    var jump: Boolean = false;

    button_mc.addEventListener (MouseEvent.CLICK, onClick);

    function onClick(event:MouseEvent):void {}
    If (Jumping)
    {
    Event.Target.y += 100;
    jumping = false;
    }
    on the other
    {
    Event.Target.y-= 100;
    jumping = true;
    }
    }

    button_mc.butonMode = true;

    Whenever a movement occurs, the break value is passed to the opposite value.  So if it starts wrong, it moves-100 pixels (which is the direction upwards) and the value is changed to true.  Similarly, when you click again, it moves 100 + in the direction down.

  • AS 3.0 - &amp; gt; communication between classes

    Hi all

    Here's a good question, that nobody seems to have all the answers for... I searched on the net and it is not really that much info at all, so I'm assuming that we AS 3.0 people do a little "trail blazing", so to speak.

    Here's my problem:

    I would have a particularly modular interface, such as the main movieclip can load in modular pieces and insert them in a framework and have this operation as a 'window' in the Flash. The charger for the movieclip must be dynamic. I'll abstain not harder and get to the point of my question:

    Let's say you have created a class to a movieclip 'circle', which is created in its very own .fla with its own (circle.as) class file that extends the movieclip class. Now let's consider this circle is one of the modules in the base movieclip that will load dynamically.

    The circle movieclip loads, but now you want to communicate with the movieclip of circle and for example, question him and ask him what color his circle is. Surely, we would create a function in the circle class, something like the following:
    public void getColor (): {of color
    Return circlecolor;
    };

    On the main movieclip, we questioned this file that has been loaded, and you can imagine the code to resemble the following:
    public void objectLoaded(event:Event):void {}
    trace ("circleloaded! And Flash coders rule! ») ;
    trace ("the color of this new object is" + event.content.getColor ());
    };

    Now my problem is that I can't connect at all! Test and debugging, it seems that the film circle will not even look at the scene as the root timeline (it will look at the charger as its personal root, I think!). Does anyone have ideas on how we can get some kind of a channel of communication between the classes of movieclip that are loaded dynamically in this mode?


    Yes sorry I forgot:
    You must send the object to a MovieClip for her to work. Full code:

    the Circle.as class

    package {}
    import flash.display.MovieClip;

    SerializableAttribute public class Circle extends MovieClip {}
    var circlecolor:Number = 0xFF0000;

    public void getColor (): number {}
    Return circlecolor;
    }
    }
    }

    This class must be attached to the document (in my case loaded.swf), use the property inspector.

    The following code goes into the swf loader:

    import flash.events. *;
    import flash.display. *;
    flash.net import. *;

    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, onCircleLoaded);
    LDR. Load (new URLRequest ("loaded.swf"));
    addChild (ldr);

    function onCircleLoaded(event:Event):void {}
    trace ("the color is:" + MovieClip (event.target.content) .getColor ());
    }

    That's all

  • height of CheckBox and movieclip question

    Hello

    I've added a component of the box inside an empty movieclip. Before adding that the height of movie clip is 0, once I've added a component to the checkbox on the movieclip its height shows 100 but when I saw the height of the box its just 22. What is the question on the calculation of the height of movieclip?

    Here is the coding

    var mc:MovieClip = new MovieClip();

    addChild (mc)

    var cb:CheckBox = new CheckBox();

    CB.label = "TTS"

    mc.addChild (cb)

    trace (CB. Height) / / exit 22

    trace (MC. Height) / / ouput 100

    Question:

    I want to calculate the height of movieclip on runtime.on the case above, I expect equal to MK 22, but it gives 100 how do I solve this problem?

    Hey, it seems that I have found why the issue occur... Component Flash need a few milliseconds to update the movieclip's parent.

    "Event.RENDER" helps here to slove the question

  • Question about the layers of Movieclip

    Hello

    I'm a total newbie.  In the photo, I click on movieclip movieclip and 1 2 appears, but it appears below movieclip 3.

    How can I make film clip 2 appears above movieclip 3 without layers.

    Thank you very much.

    KC.

    test.jpg

    You can use setChildIndex().  Here is a link to an example of solution:

    http://StackOverflow.com/questions/11737925/AS3-SetChildIndex-to-front

Maybe you are looking for