ActionScript 3.0 :: Assign Value To A Variable Based On Function?
Aug 18, 2009
If the province is zoomed IN when I click another province I want it to return to its original size and have the next province that I clicked on zoom IN. Each time I zoom a province IN I want to set a variable to the value 1 so that I can use it as an indicator to let me know the status of the other provinces. Ie: if variable ON (Ontario) has a value of 1, then when I zoom IN on Manitoba I will use an IF statement to determine that Ontario is currently zoomed in (ON has a value of 1) and will zoom Ontario out prior to zooming in Manitoba. When I zoom out Ontarion I will reset the ON variable to 0. My code for Ontario looks like this[code]...
View 1 Replies
Similar Posts:
Oct 29, 2008
I have this function and code:
[Code]...
Is there any solution to make this work so that the function carrega_movie uses the temporary value of i assigned in the for loop?
View 3 Replies
Feb 16, 2005
say I want to declare a global variable in my main movie on a mouse event (button) and give it a value "functionA".
then I want to load an external .swf into a clip (with the same mouse event)
then I want some code in the loaded .swf to execute a function of the same name "functionA"
how would I code this?
this way I could load the same .swf but execute different functions depending on which button triggered the load... comprende?
View 5 Replies
Jan 26, 2010
How can I get a variable to change based off of a function? For instance.
var imageNumber = 1;
And when I click on the next button it kicks off roughly this function.
imageNumber ++;
Effectively adding to the image number. But it is confined only to that function. The imageNumber outside of that function didnt change. How can I get the next button to change the number outside of the function?
View 5 Replies
Nov 23, 2004
I have some code that makes a variable based on an MC's name:
[Code]...
but it doesn't work, yet it traces "_level0.but1menu", and trying the function as this: _level0.but1menu.easeY(100) does work. I've also attached a mock up if you want to see what I mean. al input, this one seems weird to me - but I'm sure there is a completely logical explanation. I've used the same sort of idea to open external swfs with no issue.
View 1 Replies
Sep 12, 2011
I have an HTML button that I need to dynamically assign to an AS3 variable when clicked (in order to load an .mp3). I am using externalInterface.call to collect javascript variables - I am just unsure how to change these dynamically when a button is clicked.
View 2 Replies
Mar 11, 2010
I created an input text box. But when i try to go and click on the "variable" option to assign a variable i get this error: "This feature is not supported by ActionScript 3.0. To use this feature, you must target ActionScript 1.0-2.0." How can i do that? By the way, the variable textbox where you need to enter the variable name is gray. I can't write in it. I'm using flash CS4.
View 1 Replies
Aug 31, 2011
I wanted to make a little quiz kind of game, 4 choices and a sum randomly displayed.And i wanted to assign each time a random choice (to contain the answer) and i've done that, and can trace that 'rightChoiceBox' = _choice(random num)and i can trace the answer itself but what i've commented at the end won't work I get the error
Scene 1, Layer 'Layer 1', Frame 5, Line 221119: Access of possibly undefined property text through a reference with static type String[code]...
View 2 Replies
Aug 18, 2010
I am able to get the name of the MovieClip a user clicks on.[code]...
View 1 Replies
Aug 24, 2007
I define my instance as msg1. It is a text box with Dynamic Text.Then, I wrote the ActionScript as this:var var1:String;
msg1.text = var1;
My code included this:
<param name="movie" value="card01.swf?var1=Testing1" />.......
[code].....
View 3 Replies
Jan 25, 2009
How do I assign a property to a variable? For example, say I want to change the alpha of a clip named "theClip":I tried:
var theAlpha = theClip.alpha;
theAlpha = .3; THis doesn't work.
View 6 Replies
Oct 25, 2009
What I want to do is load an XML file into AS3 and then use two of the attributes of a node in order to assign them to variables. Here is what I have so far:[code]As you can see, I've got it to a point where I can trace the variables in the function correctly. But, as I'm sure you're all aware, I am unable to use those variables anywhere outside of the processXML function.
View 9 Replies
Dec 2, 2009
I define my instance as msg1. It is a text box with Dynamic Text.Then, I wrote the ActionScript as this:
var var1:String;
msg1.text = var1;
My code included this:
<param name="movie" value="card01.swf?var1=Testing1" />.......
<embed src="card01.swf?var1=Testing2" quality="high" ........
After compiling I still get the "Undefined" when run.
View 11 Replies
Jan 27, 2010
I'm working on a project using google maps. For part of it the user must enter coordinates and click a button in order to add a marker to a map. The code I have written so far allows this to be done once:
play_btn2.addEventListener(MouseEvent.MOUSE_DOWN, submitdata);
function submitdata(e:Event){
var marker9:Marker = new Marker(
[code]....
As it is the only one marker can be added as it keeps getting replaced. I want to make it so that the variable name changes each time a marker is to be added.
View 2 Replies
Jul 22, 2009
I'm in the process of building a thumbnail image gallery using actionscript and xml. I have an array in flash that loads in the XML data and then assigns each node from the array to either a movieclip, dynamic text field, etc. My problem lies in trying to assign a variable (in flash) to the value of my URL from XML, which in theory should simply grab the URL string from my XML file. Keep in mind, everything works fine except for assigning a string value from xml to my variable "linkVar" in Flash. Please pay close attention to "linkVar" in the code that follows.
ActionScript Code:
XML
<images>
<pic>
<image>images/flower.jpg</image>
[code]....
View 2 Replies
Feb 14, 2010
Code:
public function Text1Down(e: MouseEvent): void{
var textArea:Label=Label(e.currentTarget.id);
.......
}
I get this error:
Code:
TypeError: Error #1034: Type Coercion failed: cannot convert "text1Area" to mx.controls.Label.
I know that e.currentTarget.id is of type Label. All I want is to make a reference variable so I don't have to keep typing long names.
View 2 Replies
Aug 13, 2007
I used Digitalosophy's tute to create my Flash form using ASP to write to an Access DB with 1 deviation. In addition to 5 text inputs I used a Flash component list box. It is the only element that is passing empty data to the DB. I have both label & data fields filled out and I am using the following AS on the submit button
on(press){
loadVariablesNum
("processForm.asp",0,"post");
gotoAndStop(5);
}
I am guessing I need to use AS to assign a variable to the list box component as it only has an instance name field, unlike the dynamic text fields. Not having any luck googling the correct syntax though as most examples are of querying a data base not writing.
View 2 Replies
Jun 26, 2008
I've set up a multi-lingual fla now where you select your language with a button on the first frame and that loads in the equivalent xml file. Now Later in my swf I'm trying to load in another swf with loadMovie but I'd like to assign conditional statements to determine what xml is loaded.for code thus far I have
//first frame
var myXML:XML = new XML();
myXML.ignoreWhite = true;
loadXMLfunc.onLoad = function(ok:Boolean):Void {
[code]....
View 3 Replies
Jun 12, 2009
how to get the variable from xml file and assign it to a flash button?the button i create it myself.
View 2 Replies
Dec 30, 2009
When I assign the variablename to an inputbox an array variable i.e. myArray[3], flash does not recognize it as an array O.o it recognizes it as a string with the variable name myArray[3].
View 6 Replies
Dec 8, 2009
[code]...
I have a hundred instance of a movie clip on the stage. I would like to use "myVar" to store the name of the instance that the mouse is currently hovering over, so the function will run for that instance.
how to dynamically assign the instance name to myVar on MOUSE_OVER?
View 4 Replies
Dec 13, 2009
I want to use mutliple images in my flash script and instead of writing tons of code I want to get the 'currentTarget' and assign a variable name to it so I can tweenlite it . Instead of me naming all the instances i thought the following would work but it doesn't.
wedding.addEventListener(MouseEvent.ROLL_OVER, pan_over) ;
function pan_over(e:MouseEvent):void{
var ct:string = Event.currentTarget.name ;
[code].....
View 2 Replies
Aug 23, 2010
In Actionscript I can do[code]...
and the thing object would have a variable called somevar.
Can I do the same in Javascript if I created an element using createElement?
View 2 Replies
Jun 30, 2011
I have my custom component and for example few Label. I want to pass to my component value which will be assign to label's id.[code]Error: {test} is not a valid identifier.
View 1 Replies
Feb 5, 2009
On my stage, I have three buttons all named instances ("Yogyakarta", Banda_Aceh", "Bengkulu"). I basically want to wrap the names of these buttons (and eventually several more) in a variable (nameBtn) and then addEventListener to the variable. This should result in any of the buttons being clicked and each time performing the function 'showData'.However, I get this error message in the Output window show up...
Code:
TypeError: Error #1006: addEventListener is not a function.
at textnew_fla::MainTimeline/frame1()
[code].....
View 4 Replies
Nov 6, 2007
I've got a variable that gets incremented by 1 every five seconds. I want to be able to, (on the click of a button), grab the current value of that variable and assign that specific value to another variable.
So basically I want to pass a variable by it's value and not it's reference. How do I do that?
View 2 Replies
Dec 29, 2009
I am trying to assign a few variables to checkboxes that I am adding dynamically to the stage. There are like 40 checkboxes added dynamically and I need to keep track of a few variables for each checkbox.It will only let me assign a "name" to the checkbox. If I try something else like "Group" (see code), then I get a runtime error:[code]
View 3 Replies
Jan 18, 2011
I'm working on involving the Flash component TileList.
Essentially, I want Flash to assign a variable to each item in the TileList, so that when a user clicks on the item, the relevant product page is displayed.
View 2 Replies
Aug 7, 2011
how I can assign a movieclip instance name to a variable, so that I can use reference it?
For example:
var mcName:String = "box2_mc"
mcName.play();
It wont work and I get the error:
1061: Call to a possibly undefined method play through a reference with static type String.
Should I define it as another datatype?
View 2 Replies
Nov 14, 2011
I have external XML, for example: <node><![CDATA[Some text {VARIABLE} and some more text]]></node> Then in Flash, when XML loads, I want to assign {VARIABLE} with some flash variable.
View 2 Replies