ActionScript 3.0 :: Refering To A Specific Child?
Feb 1, 2010
In my program, I have multiple children of the same movie clip. Each movie clip has a text field inside it which shows data relating to that movie clip. However, I need some way to update that data at run time to reflect changes that may be taking place. My problem comes to, how am I supposed to target that specific child of this movie clip since there are around 40 of them on the stage at the same time?
View 3 Replies
Similar Posts:
Mar 19, 2011
I've used this site as a resource leading up to this, not particularly sure if I worded this correctly I have a class "Block" which is just a square (will be something else later on in the process) I want each block to have controls to add an additional block in either direction so I have another class BlockButtons which has my buttons for each direction.
And another class GlobalVar where I keep all my variables for funsies
[Code]...
View 1 Replies
Sep 16, 2009
I have a need to add an object to the display list at a specified frame number. Something equivalent to addChildAtFrame(mc, 100).
I know I could achieved this by creating a layer within the fla, making a new frame at the desired location, and placing a blank movieclip within the frame in order to have a target displayObject to addChild to but I would prefer to do this via code.
Is there anyway to accomplish this dynamically?
View 2 Replies
Sep 30, 2009
I'm trying to call a child from an xml to perform a function, which is seperate from the functions of all the other children. this is merely a test in learning as3 and i'm using this gallery as an example.
At the moment, I'm trying to call the second thumbnail of the gallery to react differently to the other thumbnails when clicked. So there is the "onClick" mouseevent for all thumbnails, but "onClick2" for just "thumb2".[code]...
View 3 Replies
Oct 14, 2009
I have constant series of movieclips moving across the stage, and i want the specific one to be removed when it is hit by something. (hitTestObject, i know). I have tried a lot of things but i keep getting errors.
View 2 Replies
Nov 4, 2010
I am loaded images into a container that is being displayed on a map. I've created a string of my images names and am looping a loader to load each image and add them to the container.
var overlays=["compsmall.png","compsmall3.png","compsmall3.png","compsmall4.png"]
var overlay_container:MovieClip= new MovieClip();
function calloverlays():void
[Code]....
Once all of my images are loaded into the container overaly_container how can I call on a specific child of the container? For example how can I call on compsmall2.png once its been loaded into overlay_container?
I place these images onto a map by placing the whole container at the correct location. I then turn layers on/off by adding and removing the children within the container. This is why I'd like to specify a specific object in the parent.
View 3 Replies
Nov 25, 2011
I am creating a game in which bubbles with simple math equations are falling from the top of the screen, and you have to enter in the answer to make the specific bubble disappear. The only problem is that I need a system that can delete the bubble(s) corresponding to the answer. I'm using an Actions-Frame code and a mathBubble AS class. I will show the frame code first.
stop();
var cooldown:int = 200;
var cooldownMax:int = 200;
inputAnswer.restrict = "^A-Za-z";
[Code].....
Reading the code is not completely necessary, I was just wondering if anybody could explain how I could use arrays to remove every child with the same answer as the randomized answer each child contains through variables "mathAnswer" and "mathAnswerString"
View 1 Replies
Jan 14, 2011
I've got a MovieClip that has 3 frames with different text content. I made another MovieClip and within its class I defined this code:
//this is the class of a MovieClip with a human face
if (something happens)
{
var dialogueBox = new DialogueBox();
this.parent.addChild(dialogueBox);
this.parent.dialogueBox.gotoAndStop("dialogue_info _01");
[Code]....
View 2 Replies
Nov 5, 2010
I am making a small program which shows pins on a map. The information about the pin comes from XML file including price. When a price button is clicked, lets say $900, only the pin with 900 needs to enlarge. All the pins are store inside a pinContainer_mc (blank container to put all the pins) Pin heretics pin class which has enlarge method.
[Code]....
View 1 Replies
Apr 25, 2011
How to get all child ids of myCanvas1.Also for a specific mxml tag say <mx:Move /> how to get its id from action script
<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute" xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[code]....
View 2 Replies
Sep 10, 2009
I am trying to create a game in Flash. There are 43 spaces of irregular shape in the game and I already know the X and Y location. I defined them as a class which extends movie clip, I put them on the main timeline to start and I gave them all an instance name. I want to initialize them when I am starting a new game. I defined methods to set and get the properties, those methods work when I use the instance name, but many of the spaces share the same properties. The instance names are all I+some numberm I1, I2, I3. When I try to use a variable name such as space_Id = ("I" + i) to reference the instance name I get an error "Call to a possibly of undefined method. I tried the old actionscript 2 solution of putting an eval function eval (space_id) in front of the method but that didn't work either. It resulted in the same error plus a warning. I1.My_Method (); // works but it would require 20 or so blocks of almost identical code
var space_Id:String = "I1";
space_Id.My_Method (); // doesn't work
_root.space_Id.My_Method (); doesn't work
[code]....
View 7 Replies
Feb 22, 2010
this problem has been solved. i only had to remove the "else{ return false;}" bit. I'm an animator who kinda wants to be able to do some actionscript but who isn't that good at it. atm I'm trying to make something which contains a hitTest() which should check if my movieclip (doll_mc) is touching any instance of "ground".
My attempt to make a code for this has dramatically failed and this is all I managed to make which does make a bit of sense: var nrOfgrounds:Number = 2; /*this is the number of instances, which should be kept up-to date with the project, of course.*/
setInterval( groundCheck(doll_mc), 25);function groundCheck(obj:MovieClip):Boolean{ /*returns boolean groundCheck(<objectName> [in this case, "doll_mc"]); */ for (var i:Number = 1; i <= nrOfGrounds; i++) { /* <- i've got a feeling like this bit ain't working properly*/
[Code]...
just to see what would happen, and yes, this time groundCheck(doll_mc) would only be true when doll_mc was touching ground2_mc, but not when touching ground1_mc. therefore there must be something wrong with that one bit of code, but I can't figure out what!
View 7 Replies
Jun 21, 2011
probably it is very simple, but I couldn`t find anything in the net.How can I take specific line from text field. In my case, it will be number and I`m planing to use parseInt. on that string
example:
line1 = 001
line2 = 002
[code].....
View 3 Replies
Jul 5, 2010
I simply want to be able to access 3 already created, but not yet added movieclips using a loop. I've tried a few code combination but can't figure out the syntax.[code]
View 2 Replies
Mar 8, 2004
I am generation a textField by_root.createTextField("some"+randomNumber,1);Now I want to assign some text to the textField, how do I refer to it???
I tried using a variable first like
var myText="some"+randomNumber;
_root.createTextField(myText,1);
[code].....
View 3 Replies
Jun 17, 2009
ve faced a problem. I have a super class called "Plane" which has subclasses called "Fighter" and "Bomber". each of these subclasses have a bullet type "Cannon" and "Bomb"Now I want the to send a reference of the bullet type to the super class, because bullet creation is handled there and I want to let the super class know which bullet type to create.Ofcourse I could pass a string, I just ant to know if there is a better way, like storing a class type in a variable?
View 2 Replies
Mar 8, 2004
I am generation a textField by
_root.createTextField("some"+randomNumber,1);
Now I want to assign some text to the textField, how do I refer to it? I tried using a variable first like
var myText="some"+randomNumber;
_root.createTextField(myText,1);
myText.text="something";
it doesnt work it gives me an error
View 3 Replies
Mar 31, 2004
I am reading a file with certain user defined variables like &x=30&y=50&z=100Lets the variable is caught in a function as argument myVarnow depending on the variable the user passes I need to fetch the value. ie if the user passes x i need to read the value of x.lso keep in mind i dont havehow the user has named his/her variables.What i need to do it get the value of that variable by using loadVar.this.myVar;As such it gives me undefined. There is text present in 'this' myVar represents 'x'I have tried eval(this.myVar) as well as this.eval(myVar) but in vain
View 5 Replies
May 22, 2009
This is probably ueber basic, but I don't know how to do it. I am importing tweenlite on the root timeline like this: import gs.TweenLite;
I now want animate things in other MCs. I tried something like this, but it did not seem to work.parent.TweenLite.to(text1, 3, {_alpha:100, overwrite:0});
View 5 Replies
Aug 4, 2010
I've build several movies which all work fine, but ultimately they need to run inside a Main movie which acts as a holder for the various child movies which load into it.Everything is working fine but not when they're loaded into the main movie. The main problems seems to be that the main movie has common component which relate to all the loaded child movies.Consequently the main movie has several instances - but how do I refer back to them in the child movieclips?I can't get the child movie clips to compile if I remove the references but ultimately the child movie clips need to speak to instances and functions in the main movie.Also, I've got a global function to hold the global variables but this method seems frowned on. But I need the global variables all the time and in all the movie clips.
View 3 Replies
Mar 25, 2009
I have a picture on the stage that has multiple items that have hotspots/links over them that should open a child swf on top of the background and show details about the items. then have a button in the child swf itself that removes the child from over the background so the user can click on another item etc.I found this code in someone's post and I am trying to modify it so that works for multiple swf files...it currently works for a single swf.I wan to pass the name of the button in front of the .swf in the URLRequest to have the same name as the instance name of the referring button. But I can't figure it out. Here is the code I am using on the stage
View 2 Replies
Dec 10, 2010
A question on naming objects and nameing of strings. A string has quotations "I am a string"......Q.1 If i have a movieclip on stage like an empty movieclip and i wanted to refer to the object in my code as below. As an example my movieclip is called mc1.Do i use 'mc1' single quotes....
ActionScript Code:
image_url = image.attributes.url;
trace(image_url);
[code].....
View 2 Replies
Jan 17, 2006
What I want is a hint how to make a specific thing happen while clicking a specific button. Like "if I click button 1, do this". Would like to use this script though I'm gonna add buttons over time and this is an easy way to have the functionality working.
Here's the code:
Attach Code
function hitButton(btn) {
btn.onRollOver = function() {
this.colorTo (0xC4006A);
[Code]....
View 4 Replies
Mar 31, 2006
i need to change the colour of a graphic in a specific movie in a specific frame. if i have a movie clip instance-named "sidetext" thats 15 frames long, and i want a graphic in the movie, called "letterp" to change to one of four colours that i want it to randomly at frame 10 and stay that colour uintil frame 15, how can i do this?
View 2 Replies
Mar 29, 2010
how I can loop a specific bit of my movie until a specific link is clicked?
View 5 Replies
Sep 15, 2010
how do i export specific frames not all frame. ex: if flash has 1 to 200 frames. here i want to export 51 to 150 frames as a movie. if there is any command or plugin to export movie like this.
View 0 Replies
Mar 7, 2011
so i need to make a flash that will do the next things.if user press button "x" on the next frame should display "x" text from a xml.if user press button "y" on the next frame should display "y" text from a xml.
View 1 Replies
Dec 3, 2009
I have been doing really well figuring everything out up until now.[code]How it stands, what is this link pointing to? Can I make it target a specific frame in a specific movie clip?And if someone would be so kind and explain what this is saying in 3rd grader terms.
View 3 Replies
Dec 5, 2004
cutting to the chase, Basically im loading a movie externally using this code...
Code:
on (release) {
if (S_Init == Number(S_Init)) {
loadMovieNum("s_menu.swf", _root.S_Init);
[Code].....
View 4 Replies
Feb 18, 2005
I have a sliding menu, and need to loadMovies when specific clips are in specific positions. For gallery, for example, the code I'm using is:
if (xTargetSLI = 350){
loadMovie ("gallery.swf", 1);
}
But with that code, gallery.swf loads by itself, regardless of the position of SLI.
View 7 Replies