ActionScript 3.0 :: AddChild Needs To Be Called Twice?

May 18, 2009

I have two classes, Init (which is my Document class) and LoadXML which... er.. loads in some XML data.

Init calls the LoadXML and when it has completed a green backdrop is draw to the screen...

but...

Why do I need to put addChild in both classes before the green backdrop (a simple rectangle) will show up.

Init.as

Code:
package{
import flash.display.Sprite;
import flash.display.Stage;

[Code].....

the confusing thing is why I need the addChild twice, once in each class - otherwise the green box doesn't show, no matter which one I take it out of?

And if its twice is that two green boxes on top of each other being added to the stage? one at depth 0 and one at depth 1?

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Add An Image Under Another One Called With AddChild?

Nov 28, 2010

how to add an image under another one called with addChild?

View 1 Replies

Flex :: What Happens When The AddChild, Or RemoveChild Method Is Called On A DisplayObjectContainer

Jan 27, 2011

I would like to know the internals of that method, in other words what exactly happens when I call that method. If someone can explian it with a list 1,2,3... would be great. including events..

and the addElement method too, if is possible.

View 1 Replies

Actionscript 3 :: Remove All Instances Called By AddChild Function?

Mar 30, 2011

Short multiple instances of a MovieClip are created and I need them all to be removed at the same time when a if statement is executed. [code]...

View 2 Replies

Actionscript 3 :: Flex 4 UIComponent Width And Height Remains Zero After AddChild Is Called?

Aug 25, 2011

I have a component ObjectHolder which extends UIComponent that holds many children UIComponents. However, after using addChild() to add these children to ObjectHolder, its width and height remain zero. Is it possible for the UIComponent to automatically expand to the size of its containing children components?

public class ObjectHolder extends UIComponent
{
public function ObjectHolder()

[code].....

View 2 Replies

ActionScript 3.0 :: AddChild For Loop - Display Items On The Stage Nested Inside A Movieclip Called MainItem

Mar 31, 2011

I have a MovieClip called item with the same linkage set and my first task is to display 10 of these items on the stage nested inside a movieclip called MainItem. I have dragged MainItem to the stage and have the following for loop:

[Code]....

View 5 Replies

ActionScript 3.0 :: AddChild From A Class Called By Document Class?

Dec 30, 2009

I have an FLA in which there are a number of MovieClips in its library. I also have a document class for this FLA, which I will refer to as Body.as from here out.From Body.as, I call other classes designed to put stuff together and allow for organization due to large amount of MCs I have to use in the FLA. For reference, these classes are called as such: Head.as, Chest.as, Arms.as, etc etc.Now, where Body.as is the document class, and is therefore functioning to operate all areas in the FLA, I wanted to use these additional class files to be used to manage anything related to them, including any MCs I have. I'll use Head.as for explaining. To that end, I have four MCs, each named as follows:hat1hat2hathat4s part of trying to organize it all, I want to be able to call a singular function in Head.as that will retrieve these MovieClips and add them to the stage (Or, as I hope to do once I get a bit further in, add them to a larger MC that will then be added to the stage).

View 9 Replies

ActionScript 3.0 :: Load An External Swf Called 'signs.swf' Into An Empty Mc Called 'signholder'?

Apr 12, 2010

I want to load an external swf called 'signs.swf' into an empty mc called 'signholder'.

var loadit2 = new Loader();
loadit2.load(new URLRequest("signs.swf"));
signholder.addChild(loadit2);

Everything works. Cool. But, I now want to target something within the signs.swf. How do I do it though? What is the path? Do I have to give the child of signholder an instance name? Everything I try fails.

If I wanted the root timeline of the external swf to gotoAndPlay(2) for example,...would i say...

signholder.loadit2.gotoAndPlay(2) ???
var wow:MovieClip = loadit2.content as MovieClip;
wow.gotoAndPlay(2) ????

View 3 Replies

ActionScript 3.0 :: Movie Clip Called CircleFill And Another Called CircleOutline?

Oct 30, 2007

I am having issues with startDrag(). I have a movie clip called circle. Inside circle, I have a movie clip called circleFill and another called circleOutline.onEnterFrame, this movieClip is duplicated 4 times.

When I use this:
private function onPressNow(event:MouseEvent):void
{
startDrag();
}
IT DRAGS ALL 4 MOVIECLIPS.

[Code]...

how can I make it drag my movieClip called circle? (meaning both circleFill and outlineFill)

View 8 Replies

ActionScript 3.0 :: Called InfoBox That Contains A Text Field Called Caption?

Oct 24, 2011

i have a box called infoBox that contains a text field called caption. infoBox expands on mouse-over. When it does so, I do not want the text in caption to scale up - I want it to stay at 11 pt. So far my code to prevent this from happening is not working:How do I fix this?[URL]..

View 2 Replies

ActionScript 3.0 :: AddChild From A Class - Get The Error "1180 : Call To A Possibly Undefined Method AddChild?

Jun 15, 2011

I'm trying to have a class file which can add objects to the stage via addChild; however, when I call addChild from within the class file, I get the error "1180: Call to a possibly undefined method addChild." I've tried importing flash.display.* and that doesn't fix the problem. Does the class file have to extend Sprite or MovieClip to be able to add objects to the stage?

View 8 Replies

ActionScript 3.0 :: Box2d Addchild - 41061: Call To A Possibly Undefined Method AddChild Through A Reference With Static Type Class

Jan 16, 2012

I have downloaded Box2d ([URL]) and created a project that looks like this: [URL]. catalyst is the green cube and it has the base class "shapes.box", it is inside "world" which has the base class "wck.World". What i want to do is to add another "catalyst" from the library inside "world" when i click on add_btn. I tried to accomplish this by this code:

[Code]...

Symbol 'buttons', Layer 'Actions', Frame 1, Line 41061: Call to a possibly undefined method addChild through a reference with static type Class.

View 9 Replies

ActionScript 3.0 :: Difference Between Mc.stage.addChild And Mc.addChild?

Jan 20, 2011

I have the followings:

_p:Player (which is a MC)
a1:Animation1 (which is a MC)
_p.addChild(a1); //doesn't display anything
_p.stage.addChild(a1); //displays a1

Why won't the MC display a child without using his stage?

View 1 Replies

ActionScript 3.0 :: Difference Between AddChild And Parent.addChild?

Aug 11, 2009

I'm trying to resolve an issue that reared it's ugly head yesterday.Frame one of main timeline I have the following code:

Code:
import flash.display.MovieClip;
import flash.events.MouseEvent;

[code]....

The newMC doesn't show up.If I add 'parent.' in front of the addChild then it appears.mc_LibItem has a base class of "flash.display.MovieClip" and is exporting for ActionScript and on frame one.For grins I created a new .fla and began messing around with the same addChild idea and it worked.

View 14 Replies

ActionScript 3.0 :: AddChild, RemoveChild And AddChild?

Oct 30, 2005

somewhat understood the basics of adding and removing children, however, I am facing another problem. After using the removeChild Function, I can't seem to add another child.For example:

ActionScript Code:
var attachedMC = new (getDefinitionByName("Content1") as Class)()
Page.addChild(attachedMC);

[code].....

View 3 Replies

ActionScript 3.0 :: Load External SWFs, AddChild(Loader) Versus AddChild(Loader.content), Etc?

Jul 29, 2009

I have a main "shell" swf which, by clicking several buttons, will load/unload various external swfs into a Placeholder_mc which resides on the main timeline in Shell.swf In the documentation and tutorials I've seen a couple different methods, and I'm not sure I quite understand the difference, or at least the reason you would use one over the other...In the 1st method, you can just add the Loader object using the addChild() method:

Code:

var myLoader:Loader = new Loader();
var myURLRequest:URLRequest = new URLRequest("ExternalFileA.swf");
myLoader.load(myURLRequest);
Placeholder_mc.addChild(myLoader);

This will apparently add myLoader to the display list once it has completely loaded.The 2nd method, you supposedly can add the Loader.content; however, it appears you can only do this once the content has completed loading, so you need to incorporate an event handler with the contentLoaderInfo object:

Code:

var myLoader:Loader = new Loader();
var myURLRequest:URLRequest = new URLRequest("ExternalFileA.swf");
myLoader.load(myURLRequest);

[code]....

What are the pros/cons of adding the entire Loader object, as opposed to the Loader.content and vice versa?

View 7 Replies

Wordpress Based Site That Stores Information About An Image In A Database Field Called "background" In A Table Called "wp_postmeta"?

Jul 22, 2009

I have a wordpress based site that stores information about an image in a database field called "background" in a table called "wp_postmeta".The 'loader' gets an url such as "/thisImage/background.swf"The "background.swf" should somehow display "background.jpg" instead but since I've changed the field name in the database (from background to temp_background) it doesn't work.I pass variables to the "loader" swf and they are correct based on the new field name but it still isn't working.I need to know if there is anything in the .fla's (and therefore the .swfs) that is pointing to somewhere in the database hard-coded. Basically I need someone to look at them and tell me how they are working.

View 2 Replies

ActionScript 3.0 :: Target Path - Control A Movie Clip Called "nosotrosmc" With A Frame Label Inside Called "historia"?

Oct 5, 2009

i'm trying to control a movie clip called "nosotrosmc" with a frame label inside called "historia" but does not work this is the code:

[Code]...

View 2 Replies

Actionscript 3 :: Movie Clip Called Axeframe With Yet Another Movie Clip Called Axe

Aug 24, 2011

i have a movieclip on my stage called dude inside the moviclip is a frame with a movie clip called axeframe with yet another movie clip called axe. what i want to do is make a hittest in the axeframe a so that when the axe (only axe not the character) hits an enemy(named enemy) on the stage he will disappear. this is my code:

[Code]...

View 1 Replies

Change The Colour Of A Mc Called Tab

Nov 13, 2009

I have this code in a function to change the colour of a mc called Tab1. It works fine. But when the mc is tweened it doesn't move. If I don't change it's colour with this function it tweens fine. What have I done wrong?

[Code]...

View 3 Replies

External Jpg Looks Pixelated When Called?

Apr 15, 2008

I am calling a group of "large" jpgs into a slide show viaxml at runtime.The files are at size and with no compression as they are seelocally on a touchscreen.They look good in Pshop on screen, but when viewed in the swfthey have odd edges in t etext areas or anywhere there is adramatic shift in color or contrast. It looks like compressionissues, but I have been through each file multiple times andnothing seems to be wrong.Is there a limit to what file size can be imported andmanaged clearly by flash?Movie is 1924 x 1200 and the slideshow running in the windois 1277x959(rgb,jpg,files@72DPI)Image quality is very important on these because they are on

View 2 Replies

Flex Set Function Not Getting Called

Oct 8, 2009

I've been banging my head against the wall with this one. I have the following set function in Flex. [code]If I set the periodChangeAmount to -1 or 1 the set method gets fired. If I set it to zero it doesn't get fired. What's the deal? Does anyone know why it wouldn't get called when setting it to zero. If I change the object type to a number or even an object it still doesn't work as expected.

View 2 Replies

Flash :: Called Ran First When Call It Second?

Feb 18, 2011

When I run this program the "showAPplication" method runs first. I am just a little confused as why the "showApplication" method runs before the "complete" method? Why could this be happening?

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"

[code].....

View 1 Replies

Actionscript 3 :: Specify A Function To Be Called?

May 11, 2011

I have this script for random letter cycling below. I want to call this function to happen at a certain click or frame label, but when I call it with tweenmax, I get a runtime error. Can anyone explain to me how to call this function at certain events. I know this is definitely not best practice but have to try somewhere and here is what I did:

var targetWord:String = 'home';
var wordSoFar:String = '';[code]....

View 1 Replies

ActionScript 3.0 :: Why OnLoadComplete Is Not Called?

Jan 18, 2009

the event onLoadComplete is not triggered.. why ?If I move

ActionScript Code:
this.addChild(image);
outside the method, it is working instead...[code]......

View 4 Replies

ActionScript 2.0 :: Flv Called Through A Variable

Sep 15, 2007

k i have an flv video that is called into an mc through a variable ... and its workin just fine ... anyways... does any one knows how can i assign a preloader for this flv?

View 4 Replies

ActionScript 2.0 :: Load A MC Into A Swf, Called From Another Swf?

Nov 4, 2007

I have a menu.swf dynamically loaded into a site, and when the user clicks a link i want to load a mc into the main.swf. So i have to do loadClip("menu.swf", theotherswfsmc)...

View 6 Replies

IDE :: Function Not Getting Called In OnLoad?

Mar 9, 2009

I am loading one xml file and onload (or onData) of this file I am calling another function but, this function is not getting called. What can be the issue? Can delegates be used here and how?

Here is the code for reference

Code:
//path for _global.bookXML is defined already.
_global.book_xml = new XML();
_global.book_xml.ignoreWhite = true;

[Code]....

View 2 Replies

Button Being Called Inside MovieClip?

Apr 27, 2009

Can the button be called inside a movieclip?

View 6 Replies

ActionScript 3.0 :: MOUSE_OUT Being Called Erroneously?

Aug 20, 2009

On the 'buy' screen, there are 6 unit buttons with which you can buy troops. You can control these by clicking and holding.Clicking 'play' to go into a battle has 6 identical buttons used for deploying the troops you bought. These _should_ be able to be held down, but there is a problem. It seems that they erroneously call a 'MOUSE_OUT' event even if your mouse is not moving.The pattern dictating which battle buttons can be held and which can't is as follows: any buttons you clicked on the 'buy' screen will get bugged on the battle screen.But I don't get this. They're not the same buttons. I quite thoroughly remove them before going to the 'battle' screen (though I'm not convinced this actually means they're gone):

Code:
beginMatchButton.addEventListener('menuButtonClicked', function(e:Event):void {
for (i = 0; i < buttons.length; i++) {

[code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved