ActionScript 2.0 :: Storing Variable To Use In Another Movieclip
Jan 5, 2011
This script from MC 1 loads an template from the library and then creates as many instances as the XML says.
It also creates a dynamic variable called ppp. This variable i want to store in each of the newly ceated instances and then use it in another movieclip to load the right path where i want to load another xml file in Flash....
This is what i want to accomplish:
xmlData.load("albums/album"+ppp+"/images.xml");
This code is in another movieclip (MC2) and gets loaded in frame 5 of MC1.
Another soltuions is if it is possible to read the value that is loaded in the dynamic textfield nummer_txt from the template:
Actionscript Code:
[Code].....
View 2 Replies
Similar Posts:
Oct 14, 2009
I am trying to create a navigation where a button is highlighted with a glowfilter when clicked and then unhighlighted when another is clicked. I have this code that I think should be working, but for some reason the variable lastClicked is never assigned and always returns null.[code]
View 4 Replies
May 17, 2006
There is a combo-box by the name "cbJobs" and it gets its value from the XML file named "data.xml".. I want to store the value transferred from this XML file into a variable.. so basically someone told me to use the code
on (change) {
_root.subject = this.getValue();
}
the only problem with this code is that it gets activated only after I "change" the value in combobox by pulling it down.. I want to use this value obtained from _root.subject as a subject in the script
getURL("mailto:abc@abc.com?subject="+_root.subject);
View 1 Replies
Jul 28, 2009
I have made a variable and am trying to store it as a number that the user enters from an input text field. I am trying this, but it does not work:
var myNumber:Number = myTextField.text;
when i trace myNumber, it comes out blank. How do i get the variable to be the number that is typed in the myTextField?
View 9 Replies
Feb 21, 2010
I have a movie clip and inside that movie clip there is a button. I will be copying this movie clip 40+ times. When you click the button it must seek out the reference name of the movie clip it is nested in. The point of the script on the button is to make all other boxes but its self vanish. The script needs to know what box it is so it can make all boxes but it's self vanish. I know that _name returns the name of the object the code is on but what about the movie clip the object is in maybe _parent._name?
View 5 Replies
Apr 2, 2011
i want to make the elements for an array, each one i++........so
ArrayOne = Array()
ArrayOne[i] = i
i++
make it work so the array would liik like....
ArrayOne = [0,1,2,3,4,5,6,7...]
View 2 Replies
Jun 10, 2011
i want to make the elements for an array, each one i++.[code]can somone make it work so the array would liik like.ArrayOne = [0,1,2,3,4,5,6,7...]
View 1 Replies
May 4, 2007
I need to hold a couple of variables in an outside file that can be incremented by user activity -- not just during one interaction with the swf, but with every one.I have no problems with using loadVars and I get the loadandsend process; it is just that I have
no background in cgi or asp for holding the variable and being able to update it.I know I cannot write to a txt file -- that is what I have been using thus far with loadVars for importing values, but this will not help me here. I know it should be a fairly simple script -- I also know I ought to pick up php, but for the moment -- until a greater amount of time comes my way -- I turn to you.
View 3 Replies
Mar 16, 2012
For my calculator i am having trouble storing a number inside a string variable.
[Code]...
Calculator, Layer 'actionscript', Frame 1, Line 1441061: Call to a possibly undefined method append through a reference with static type String.
View 5 Replies
Dec 6, 2011
I have a flash assignment that. The assignment is to create an application for playing a card game, I have to create an MXML component that has two variables, one variable stores the image of the back of a playing card, the other variable has t store all 52 options of a front facing card (the second variable will store over 50 images).
I've written the variable for the back of the card image like this:
[Code]...
View 1 Replies
Mar 16, 2012
For my calculator i am having trouble storing a number inside a string variable.
Calculator, Layer 'actionscript', Frame 1, Line 1441061: Call to a possibly undefined method append through a reference with static type String.
Code:
var currentNumber:String ="";
function pressNumber(e:MouseEvent):void{
display_txt.appendText(e.target.num);
currentNumber.append(e.target.num);//error here
}
View 7 Replies
Feb 16, 2009
I'm trying to make a game that is turn-based and allows players to first be selected, then click on a grid square to move there. However, I can't get a way for a variable storing whether the player is selected to be passed back to the actual grid class. I want the grid class to have an event listener that when the grid is clicked on, it will move the player there only if the player is selected. But whenever I try to declare a global variable either inside the grid class or even a document class or even access properties of the character class I'm trying to move I get errors.
View 5 Replies
Sep 17, 2004
This is really holding me up, so I hope someone can help me fast. I need to store each value of my for loop in a separate instance of my movieclip, but the movieclip only seems to pick up the last value of the loop.
Why is this and can I do this any other way apart from storing the value in a textfield or creating a loop within the movieclip?
View 3 Replies
Sep 17, 2004
I need to store each value of my for loop in a separate instance of my movieclip, but the movieclip only seems to pick up the last value of the loop. Why is this and can I do this any other way apart from storing the value in a textfield or creating a loop within the movieclip?
View 3 Replies
Aug 1, 2009
i'm trying to make it easy for artists and level designers to implement game entities without writing a drop of code.
for instance, 5 different monsters are similar but with different attack speeds. i'd like to embed stats (for instance attack speed, health, etc.) in each of their movieclips.
the only way i can think is to embed textfields with instance names of "attack speed" and "health", and then delete the textfields at runtime. is there a more legitimate way of doing this?
View 3 Replies
Aug 21, 2009
I want to declare a variable on the main timeline that can be called from anywhere in my movie. So, _global var should be the right approach. I want to declare a movie clip 'MC1' "open", or "closed" so that when it is revisited, my flash file knows the user has been there before and performs a different task from the one it does when 'MC1' was first encountered. So, i need a 'if' statement to run from the variable, when the playhead encounters the movieClip.
[Code]..
View 2 Replies
Oct 10, 2008
I have been banging my head against a brick wall regarding the following problem which must be very simple to fix, just can't see the answer.I have a class assigned to a movieclip called canvas. The class is called drawClass. I have called the instance of canvas on the stage 'drawingCanvas'.When I trace "drawingCanvas" I get object drawClass] which is fine. Tracing drawingCanvas.name gets me the instance name 'drawingCanvas'.This is a String variable.Basically what I am trying to do is pass the MovieClip name to another class. In my example the class 'toolBar', which can then interact with the MovieClip.
The problem is passing 'drawingCanvas.name' results in a String, so I get an error saying :TypeError: Error #1034: Type Coercion failed: cannot convert "canvasArea" to flash.display.MovieClip.I can't for love or money find a way to convert a String variable to a MovieClip variable! I have the name of the MovieClip, I just need to tell the toolbar class. But I can't find a way of doing this as the instance on stage is an object of drawingClass, not a MovieClip (unless MovieClips with attached classes are not treated as standard MovieClips?).
View 9 Replies
May 17, 2011
I am brand new to AS3 and just about muddled through with AS2. I have a problem which should have a simple solution but everything I try gives errors.I had a load of buttons on the main timline which worked fine. I have moved a load of them into another movieclip called flyoutMenu. Now none work and I get the error:Error #1065: Variable about is not defined.This is the code stripped down to one button:[code]
View 2 Replies
Dec 8, 2010
I am trying to access the variable myParentVariable within the function myParentFunction() from the MovieClip's myMovieClip_mc function myMovieClipFunction().
I know that It works if I declare the variable myParentVariable outside of the myParentFunction() but I don't really want to do that
main timeline
//-------------------------------------------------------------------- ---
myParentFunction();
function myParentFunction():void
[Code]....
View 1 Replies
Mar 30, 2009
This is something I'm experimenting with, but haven't seemed to figure out... I have several MovieClips, basically the same, only different colors. As each one plays, I'd like it to "overlap" whichever one is already there. Right now I have each button linked to a gotoAndPlay function, but I don't think that will ever get me what I want. You can see how I have it now here: [URL]
Instead of having the content MovieClip go back to all white when a button is clicked, I'd like the preivious one to remain, and get "covered up" by the new one. You continue to see the old color, and the new color overlaps it. I have a feeling I need to use a variable and then addChild, with a removeChild for the old MovieClip after the new MovieClip has loaded, but I'm not getting any good results yet.
View 1 Replies
Aug 1, 2005
I have a loop that creates movie clips where the movie clips are named mc_+ x for say x = 1 to 10 so the movieclips are called mc_1, mc_2.....mc_10.
What I need to do is the know which one of the movieclips is clicked on but more importantly the number i.e if movieclip mc_2 is clicked on then I need to use the value 2.
At the moment I am sending the value of x to be displayed in a text box within each movieclip:
_root.search.textfield.text = x;
Then I have a piece of actionscript that uses the value of x but I don't seem to be able to "re-read" the value of x back with:
var t = _root.search.textfield.text;
what I want is t = x is it to do with strings and number variables?is it possible to send the variable x to each movieclip so that it can be called from within each movieclip instead?
View 1 Replies
Jan 9, 2009
i have 4 txt boxes which load 4 prices from a txt file that works ok. if the user then changes the price in the box and hits a button:-
on (release) {
time = new Date();
url = "./store.php?time="+time.getTime()+"&post="+escape(po
[Code].....
View 4 Replies
Aug 8, 2009
I want to create several "buttons" (which are actually MovieClips) that are all identical apart from an image and the link. My thought was to create a movieclip button that contains a var that will represent a movieclip, then in each instance of the movieclip button set that variable to be the movieclip image that will correspond to the button.
Geez my query seems so simple until I try and put it into words...The gist of it is, how do I name a movie clip variable? Something like, in the main movieclip, instead of inserting a specific image into the movieclip, insert a variable named innerImage, then in each instance of that movieclip name the image to be inserted by specifying the variable
var innerImage:MovieClip = the movieclip I want for this instance.
If the var was a number, it would just be:
var innerImage:number = 4;
If the var was a string:
var innerImage:string = "word";
So for a movieclip:
var innerImage:MovieClip = ???
View 10 Replies
Oct 28, 2009
I have four buttons currently set up to do all sorts of stuff in a flash file. What I'd like to do is have them all point to the currently displayed movie clip on my main timeline.
At the moment they're set up to test the addChild and removeChild functionality I've written and it seems ok. I would like to trigger removeChild and addChild by the last frame in a movie clip and have my buttons send a play command to my movie clip. That way the clip plays to the end before removing itself and adding a new movie clip.
The movie clip that I would like to trigger the addChild and removeChild functions is actually one of four movie clips so I need to declare play(); and send it to the current movie clip regardless of which one is on the stage.
[Code]...
View 1 Replies
Feb 3, 2010
I have a button inside a MovieClip (instance name: bt_fechar) and I want to refer to it from the main timeline (that's where I want to keep most of the code). It returns the following output error message: "Error #1065: Variable bt_fechar is not defined"
Heres the code:
function retirarCiclo(event:MouseEvent):void
{
[code].....
View 1 Replies
May 2, 2011
I am very rusty on my actionscript but here is my issue.I am declaring a variable:var activeTab = "none";the using the varible in a function the variable is working and holding the name of the movie clip that was clicked:
function moveTabs(event:MouseEvent):void {
if (activeTab == "none"){
activeTab = event.target.name;
[code]....
View 1 Replies
Jun 10, 2011
So say there are 10 movieclips on the stage, each named mc1 mc2 mc3 etc. In a public class I have a function that sends the name of a movieclip and I need to be able to change the frame of that movieclip based on the string that is sent. So say my class function declaration is:
moveFrame(theMovieClip);
Where theMovieClip is the returned object from another function. Is there any way to use that variable somehow? The concept of what I'm trying to do:
function moveFrame(s) {
s.gotoAndStop("the right frame");
}
View 4 Replies
Apr 11, 2012
is there a way to make all the movieclip that I want to load on stage into an array?
if (selectDiffText.text == "Collection 1 Easy")
{
var c1_easy:cartoonEasy = new cartoonEasy();
addChild(c1_easy);
[Code]....
now I have 3 movieclip in library which is cartoonEasy, cartoonMedium and cartoonHard. I'll add one of them into stage but with different variable. is it a way I can make them just using ONE variable only? is it using array?
because if just using 1 variable then i can easily control object inside 1 of the movieclip that I called from library.
what I'm thinking is like this:
var c1_all:cartoonAll = new cartoonEasy() = new cartoonMedium() = new cartoonHard()
View 2 Replies
Dec 18, 2009
i have two strings and i wish to use the value of these to firstly, name the new movieclip and secondly, use it to call the class name in Linkage. is it possible? so far i've tried this.
var [pageName].MovieClip = [page]
addChild[pageName];
and get the error message "1084: Syntax error: expecting identifier before leftbracket."
[Code].....
but as this is the same name as the variables it throws up an error message..
"1086: Syntax error: expecting semicolon before dot."
View 7 Replies
Jun 25, 2010
ActionScript Code:
<MovieClip>.colorTransformTo(ra, rb, ga, gb, ba, bb, aa, ab [, seconds, animation type, delay, callback, extra1, extra2]);
[code]......
View 2 Replies