I have many MovieClips and each has a name like "mcDummyClosed" and then and instance name "slideDummyClosed". Another MovieClip has a link to e.g. slideDummyClosed which I then call DummyClosed. I add a MouseEvent.CLICK event to DummyClosed.
Now without adding slideDummyClosed to the stage nor any other MovieClip can I with a string containing it's name get that instance? I've tried using getChildByName() but that only seems to work if I've already added the MC to be found and added before. My code looks something like this:
I have made 30 movieclips for my level selection screen. Then I create a movieclip with the same name using a for loop. With that code I make roll_over function showing a Tooltip. I then want to trace what button is being clicked. My whole code is here: [URL] I want to trace what button is clicked, so I can show it on my tooltip textbox.
I'm trying to declare a movieclip variable in a class by finding the instance name of the movieclip.
On my stage I have a 'Container' (linkage class name) MC, inside that is a 'PlayerInfo' (linkage class name) MC inside that is a 'healthBar_mc' (instance name) MC. healthBar_mc is what I'm trying to access.
the class where I'm trying to run this function is linked to a MC inside 'Container'
I'm trying to use XML to load in 4 images to a movieclip within a movieclip that is already created on the stage. I'm trying to do this in a loop since there are 4 movie clips I'm trying to access. I can get it working without the loop, but it's figuring out the syntax that's causing the problem. Currently I have the following code:
function ParsePics(picsInput:XML):void { var picsList:XMLList = picsInput.pic.image; for (var i:int = 0; i < picsList.length(); i++) {[code]..............
I seem to be having a bit of a problem here. I'm generating a load of class instances using the following code:
maxpersons=25; for (var i:Number=1;i<=maxpersons;i++) { var person:Person = new Person;
[Code].....
OK. I then need to run through each of them and check for a collision with an object from the main stage (called redDot), which I pass to a method (called doDamage) within the class. I'm using the following code:
for (i=1;i<=maxpersons;i++) { if (game.getChildByName("person"+i).hitTestObject(red Dot)) { game.getChildByName("person"+i).doDamage(redDot); } }
I keep getting an error saying "1061: Call to a possibly undefined method doDamage through a reference with static type flash.displayisplayObject."!
It just won't work. I've tried altering the code to:
game["person"+i].doDamage(redDot);
but I get an unexpected trace output saying "TypeError: Error #1010: A term is undefined and has no properties."
I have a several functions that I can compact into 1 function via a for loop if only I can find a way to call the variable by name.
For example:This is what I want to accomplish: (However I do not have the slightest clue as to how to go about doing the below...)
ActionScript Code: var test1:String = "testing 1"; var test2:String = "testing 2";
[code].....
I am able to do something similar to the above when using objects using methods such as: (I know not efficient, but its just an example to show what I am trying to accomplish.)
ActionScript Code: var test1:String = "testing 1"; var test2:String = "testing 2";
nav_mc.getChildByName("go" + i + "_mc").alpha = 0; // this works fine
but then if I add this:
nav_mc.getChildByName("go" + i + "_mc").gotoAndStop(2); // Doesn't work nav_mc.go1_mc.gotoAndStop(2); // Works
nav_mv is a MC on stage, it's child is another mc whit 2 frames in use.why the gotoAndStop doesn't work with the getChildByName?this is the error I'm getting: 1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display: DisplayObject.
I'm trying to use the getChildByName function and for some reason it's not working. Here's the line that is causing the error of "TypeError: Error #1006: getChildByName is not a function."
PHP Code:
var contactBox:MovieClip = anyBox.getChildByName("earthBox" + i);
It is in a for loop and is definitely calling to a movieclip of the correct name in the MC array anyBox. I've searched the internet and haven't found anything (On the first page of google...)
I have just recently started playing around with AS3 and am pretty new to what is going on in Flash (though I do have a lot of programming experience.) I have an object that I am dragging around on the mouse. I want it to be destroyed if I drop it anywhere but in a target location. I have the part where it is destroyed working, but I am running into a problem trying to find the target. When I try the following...
PHP Code: public function DropObject(){ if (! this.hitTestObject(stage.getChildByName("Target"))){ stage.removeChild(droppedObject); stage.removeEventListener(MouseEvent.MOUSE_MOVE,droppedObject.MouseCursorMove); }}
I get "TypeError: Error #2007: Parameter hitTestObject must be non-null." So, "getChildByName" is returning null, but I'm not sure why. I've verified that there is an Instance name of the Target on the stage. Why can't I find it?
My application will load an xml file that has the name or id of a UIComponent. Later this will be used to set text or images.
This component could be on a panel or a panel in a panel, I am not familiar with flex but in javascript getElementByid would return the element wherever it is on the document (when called on the document). There is no get....Byid in fex and getChildByName does not look in children.For example
Thinking of creating a getElementByid but has to be called from the top element, have no idea what the top element is. For example this.root does not have a getChildren method to go through nor does stage. Guess I need to find the highest possible Container class starting with this.parent.There must be a "simple" way to do this but all examples I could find would not go from top level to lowest child as javascript would do in document.getElemetByid.
I found out that I can't target a object inside the main MC if I use getChildAt / getChildByName. It will return me Error #1119: Access of possibly undefined property someProperty through a reference with static type flash.display:DisplayObject.
I was trying to use something like this.getChildAt(0).getChildByName("objectName")....
I've been wondering if it is possible to convert an object acquiredby a getChildByName() function to another class?Let's say i have a library item designated as MovieClip and it is a part of some "sprite sheet". Now, when i need some sprites for my program i create a new sprite sheet instance and then i take sprites from it using the getChildByName():
Code: sourceSheet = new UISpriteSheet(); someObject = sourceSheet.getChildByName("someObject");
I am attempting to set the propreties of a navigation button (movie clip) that has been built dynamically. The button contains a text field that I want to format and a movie clip that I want to adjust the alpha. I find the object using getChildByName(), however do not seem to be able to set the properties using the code below.[code]
I have written a piece of code where I have created a custom class containing some of my custom properties.I have used multiple instances of this custom class in my main class and added it to a container.Now I need to access one of my custom property in the main class through container.getChildByName()."custom property", but I am not able to access my custom property using this.I get an error saying Access of possibly undefined property orientation(this is my custom property) through a reference with static type ..name of my main class.
Is there no way that can i access custom property of components through the getchildbyname method of the parent container ??
All i really want to do is be able to affect multiple movieclips at once with event listeners and greensock tweens.
The first snag I hit was that I couldn't create references to movie clips using the old [] Associative array referencing method. Maybe I still can with AS3, but I couldn't get it to work...
So I found another technique using getChildByName that returns a reference to a movie clips and allows me to store that reference in a variable.
However, the movie clip I'm trying to affect with an event listener resides inside of another movie clips, so to build the address (aka, root.mc1.m2.mc3) to the mc I want to get to is proving to be difficult. (I'm very new to AS3...)
I thought the trace(target1_mc.target2_mc.name); at the bottom of the following code would output the name of target2_mc but it doesn't.[code]...
All i really want to do is be able to affect multiple movieclips at once with event listeners and greensock tweens.The first snag I hit was that I couldn't create references to movie clips using the old [] Associative array referencing method. Maybe I still can with AS3, but I couldn't get it to work..So I found another technique using getChildByName that returns a reference to a movie clips and allows me to store that reference in a variable.However, the movie clip I'm trying to affect with an event listener resides inside of another movie clips, so to build the address (aka, root.mc1.m2.mc3) to the mc I want to get to is proving to be difficult. (I'm very new to AS3...)I thought the trace(target1_mc.target2_mc.name); at the bottom of the following code would output the name of target2_mc but it doesn't...[code]
I have a movie that loads a head and a body onto the stage. I want to send it a command to delete the existing load different heads and bodies. Heres what I have and in theory would like to do:
How do you write this so that it works?... i think it is a problem becuase when you minus 1 from nIndex it thinks that it is a number and thereofre not part of a string /name..nIndex is set as datatype number but getChildByName("picMc"+nIndex) works fine it is only when i try and minus 1 from it that it doesnt work.. cheers to any responders J.
var data:Object = _dataProvider[0]; trace(data.type);//This gives back the string Foto var slide:Sprite = new (getChildByName(data.type+"Slide")); addChild(slide);
So if i'm declaring my variable with getChildByName the result should be FotoSlide. But it doesnt seem to work. I think it has to do because getChildByName can only be used when a child is added to the stage?
I'm writing a video chat application, and in order to have more flexibility in HTML design, I'm using 2 flash instances for this on my HTML page - Instance 1 - For the client's webcam and microphone (broadcaster)Instance 2 - For the partner's video (receiver)I've got this to work just fine with a Red5 server,But Windows 7 has a built in option that whenever a voice/video chat starts, it automatically reduces the sound of all OTHER applications by 80%.The problem is that Windows 7 sees these 2 instances as 2 different applications, and reduces the partner's voice by 80% !!!other posts on this matter:1) [URL]..
I have a doubt: When you open various flash pages in tabs, for example in Firefox, all those pages share the same Flash instance or each one use an instance of flash??
There's 3 boxes I'm indexing through with a timer. They disappear in sequence. How do I make them reappear?
boxes disappear in sequence 1-3
var pink:Array = ["","boxInstance1","boxInstance2","boxInstance3"]; var timer:Timer = new Timer(555); timer.addEventListener(TimerEvent.TIMER, onTimer);
[Code]....
I'm not to particular about the sequence they disappear and appear, but it need to keep going in a loop.
I'm working with Flash Builder 4.6 as an IDE and Flash CS5.5 to create library items. The problem is - when I put an instance of a library item on the stage or inside of another item, Flash Builder fails to detect the instance name that was declared in Flash CS. This doesn't prevent the code from compiling just fine though.
I understand that the IDE only sees the fields that I have declared directly in the .as file, but it really hinders me that I the IDE goes crazy when I do this.
Is there any way to circumvent this - other than dynamically creating and placing the instances?
I am building a website in flash and I am totally new to action script, borrowing script from around the internet. I have been searching for days on how I could link my Flash pages to each other but I cant find anything (for action script 3), What Code do I use? Also I am looking for how I could add links to pictures in my title List Component to other pages I have created. I have Included the Script I have made for My Title List Component, How can I insert Urls or Links into this code for each Item?