ActionScript 2.0 :: Variables With Function - Makes A Variable Based On An MC's Name

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


Similar Posts:


ActionScript 3.0 :: Call Function Based On Variables?

Nov 4, 2009

ActionScript [code]...

how to make it run a function based on var's value?[code]...

View 1 Replies

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

ActionScript 2.0 :: Calling A Function Based On Variable's Value?

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

ActionScript 3.0 :: How To Change Variable Based On Function

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

ActionScript 3.0 :: Variable Take Away Another Variable Which Makes Answer1 Variable

May 15, 2011

i have a variable take away another variable which makes answer1 variable i then want answer1 to be to the power of another variable how can i do this in flash

View 5 Replies

Actionscript 3.0 :: Function Makes Volume Louder?

Jan 10, 2009

I'm working on an application and have the following button setup:

-a movieclip for the button
-a movieclip to play behind the button on roll over (referenced to by buttonSunArray[x])
-a sound that I'd like to play (starting slightly into the sound) when buttonSunArray[x] gets to frame 14

I've used the attached code used to that end. The problem is: if I quickly pass over a button (before buttonSunArray[] gets to frame 14) and go back and sit on it (until it reaches frame 14), the volume of the soundclip increases. If I pass over the button quickly 5 times and then go back and sit on it, it's extremely loud (increases by a certain amount 5 times, I'd suppose).I've tried a number of things, like adjusting the clip volume when timeHasCome is called, but it didn't help.[code]

View 4 Replies

ActionScript 3.0 :: MouseEvent.CLICK Not Working But Using MOUSE_OVER Makes Function Work?

Aug 27, 2009

The main AS timeline creates the enemy instance and calls them via the timer class. Inside the instance enemy movie clip there is some script to do a basic tween and there are functions to remove the enemy and to declare you've hit the enemy. The problem I'm having is when I try to call my KillEnemy function with a MouseEvent.CLICK (or MOUSE_DOWN, MOUSE_UP) event, it isn't registering, I realised this after testing the same function to listen for a MOUSE_OVER, MOUSE_OUT, it worked perfectly.

Can anyone explain why this is happening? Not just that the mouse seems to be a little delicate, even with the roll over listener called it isn't registering the event unless it hits a specific part of the movie clip enemy, which leads me to believe the movieclip is somehow built incorrectly? But even when testing the game with extreme settings (i.e. leaving the enemies on screen for a long time) the mouse clicks aren't registering still. Something is broken! Here is some of code inside the enemy movie clip, the problem lies on line 11:

[Code]...

View 6 Replies

Actionscript 3 :: Flash Cs5: Set A Variable Using A Function, Then Read That Variable From A Different Function

Jan 29, 2012

I have a public variable and I am trying to set it, then read it from a different function:

public var str:String;
public function DailyVerse()
{
function create() {

[Code]....

My trace results says null. Why does it not give me "hello"?

View 1 Replies

ActionScript 3.0 :: XML Variable - Get The Folder Name (xml.folder.@name) Based On The Imagem Variable Content With The Command

Sep 13, 2009

I have a xml variable with:

[Code]...

I'm trying to get the folder name (xml.folder.@name) based on the imagem variable content with the command: example: folderfile = beach.jpg (dir should be vacation) Quote: dir = xml.folder.(xml.folder.files.imagem == folderfile).@name;

View 3 Replies

ActionScript 3.0 :: Referencing A MovieClip Based On Variables

Mar 15, 2012

I am having trouble referencing a MovieClip based on certain variables in my code. I am using Flash Player 9 as the player setting and ActionScript 3.

I have a symbol with a name "Check1" set as a MovieClip, exported for ActionScript, I have ten of these on the stage with an Instance Name of ch0, ch1, ch2...ch9.

Each ch? has 21 frames on the timeline, each with a label name (named with a Number reference "00", "32", etc...) and a different image in each keyframe.

What I would like to do based on these variables:

Code:
iTurn = 1;
iLeft = 3;
iRight = 2;

This is how I would like to use it:

Code:
Check1.ch[iTurn].gotoAndStop(iLeft+iRight);

//iLeft & iRight as a frame label and not a frame number, so in the case I would like to access framelabel "32" which is frame 10 on the timeline.

I have tried many way to try and make this work with no luck, the only way I have been able to make it work is by using:

Code:
ch1.gotoAndStop("32");

Doing this, I would have 10 clips, each with 21 possibilities. I can do this with many lines of code but I have been unable to tighten it into smaller code.

View 5 Replies

ActionScript 3.0 :: Run An If Statement Based On The A Variables Datatype?

Apr 7, 2009

I am trying to run an if statement based on the a variables datatype

var theArray:Array = ['element1','element2'}];
var theString:String = "I am string";
trace(gettype(theArray));
// In php gettype() is what I use to get the type. Is there a similar function in as3?

View 2 Replies

ActionScript 2.0 :: Xml Based Dynamic Variables To Post To Form?

Jan 12, 2011

I am trying to create dynamic variables to post to a form based on the content of some xml.I have loaded 15 objects which act as buttons into my movie and each button will trace the exact title as wanted. What i want to know is that when i click the button the title is stored in a dynamically created variable to be used later for posted to a php form.

PHP Code:
// sprinkles function
function GenerateSprinkles(sprinkles_xml) {

[code].....

View 1 Replies

Flash :: Import Variables From A Text-based File?

Nov 12, 2011

I couldn't find a good, clear question and answer for this in StackExchange, so I'll pose this as clearly as I can and hopefully get a clear, concise answer.Suppose I have a .txt* file with variables for a bunch of objects of one type that I was to load into an ActionScript 3 program. I can use an import statement such as:

[Embed(source="test.txt",mimeType="application/octet-stream")]
private var testFile:Class;

for some of the places where I need to do this, but I also need to know how it's different for files chosen by the user from their local hard drive.n code, how can I convert this file, testFile:Class into an array, result:Array, of strings?*: If you have a solution using .xml or another format, please also include a sample of what the file's contents would look like and how you would get them into variables within AS3Edit: Below is a quick example file I threw together, test.txt:

testing
1
2

[code]....

View 1 Replies

ActionScript 2.0 :: Xml Based Dynamic Variables To Post To Form

Jan 12, 2011

I am trying to create dynamic variables to post to a form based on the content of some xml. I have loaded 15 objects which act as buttons into my movie and each button will trace the exact title as wanted. What i want to know is that when i click the button the title is stored in a dynamically created variable to be used later for posted to a php form.[code]

View 1 Replies

ActionScript 2.0 :: Based On Variables GotoAnd Paly Diferent Frames?

Sep 20, 2011

i have site where images and text louding from xml file - I need to add to load diferent btns for different image.here is code

onClipEvent (load)
{
this.useHandCursor = false;[code]...........

View 4 Replies

ActionScript 2.0 :: Read And Compare Variables And Then To Jump To A Particular Frame Based On The Result

Jun 28, 2011

I have written some code to read and compare variables and then to jump to a particular frame based on the results (pretty simple stuff). It works fine when I use a button to trigger the code but I want it to happen automatically.

I have tried using the OnEnterFrame thingy but it doesn't work and I tried just placing the code on frame 1 and letting it do its thang but that didn't work either....

I'm using the .swf in a third party program and using the API for that program to supply the values.

here is the code:

_parent.InitializeExternalVars();
var m_varStrEndSlide;
function display(){

[Code]....

View 0 Replies

ActionScript 3.0 :: Decreasing A Graphic Symbols Width By A Percentage Based On Two External Variables?

May 27, 2010

I am trying to decrease a graphic symbols width by a percentage based on two external variables.

Code:
var currentHealth:Number=70
var totalHealth:Number=70

[code].......

View 6 Replies

ActionScript 2.0 :: MovieClip To Go To Certain Frame Based On Variable

Jun 17, 2011

I am building a very long and detailed flash training program. I need to get a MovieClip to goto a certain frame based on the value of a variable that is defined on a keyPress.

Here is the code:
fscommand("trapallkeys", "true");
trace(nmhho);//show the value every time this frame loads
if (nmhho == 1){
Nav_Mode_Hdng_Hold_Override.gotoAndPlay(2);
}else if (nmhho == 0){
Nav_Mode_Hdng_Hold_Override.gotoAndPlay(1);
[Code] .....

The MovieClip in question is "Nav_Mode_Hdng_Hold_Override" "nmhho" is a number variable that is already defined and set to 0 initially, on keyPress of 9 it changes to 1, and when u press it again it changes back to 0, the problem is that when the page loads the "IF" statement at the beginning does not tell the movieclip to go to the proper frame.

View 1 Replies

ActionScript 1/2 :: Displaying Text Based On Variable

Jul 20, 2010

I have a variable defined as brushSize. Depending on the value of brushSize, I want to display text in a dynamic text field that relates to its value. For brushSize values of 3, 13, 23, 33, and 43 I'd like to display 1, 2, 3, 4, and 5 respectively. I'm not really sure where to begin here, but I have tried and failed with something like this:

[Code]...

View 3 Replies

ActionScript 3.0 :: How To Call Different Class Based On Value Of Variable

Sep 29, 2009

I'm brand new to actionscript and I've decided to try and make an overhead tile scrolling game. It's been going good so far, but here is my problem:
I have the level data stored in an array, where the number represents the corresponding tile.
I have movie clips in my library called "tile_1", "tile_2", "tile_3" etc.
Anyway, what I was thinking of doing was this:
var newTileContents:("tile_"+lvlArray[i]) = new ("tile_"+lvlArray[i])();
newTile.addChild(newTileContents);
Where, if the value in the lvlArray at [i] is 2, then it will create an instance of tile_2 etc.
But I am not sure how to to type the "tile_"+lvlArray[i] bit properly.

View 7 Replies

ActionScript 2.0 :: Goto Frame Based On Variable?

Apr 8, 2011

The website I am currently making is quite dark so before the user enters the website I want them to drag a slider until text onscreen is a suitable brightness then when they click enter to continue into the site I need the background mc to go to a frame relative to where the slider was.

[Code]...

View 0 Replies

ActionScript 2.0 :: Swap Image Based On Variable?

Apr 13, 2011

What I'm looking to do is have an image swapped with another depending on the value of a variable, but I'd also like it to choose the image automatically.[code]...

what i want it to do is when a function is called if the var == 01 it will automatically swap that image with pic_01, if the var == 02 it will swap it with pic_02. However is there a way of doing this without having to actually write an if statement for each of the pics as there is going to be around 700 of them.

View 2 Replies

ActionScript 2.0 :: Change A MC's Frame Based On Variable?

Jan 14, 2012

I have a very weird idea, but i can't make it work.

Theres a Movie Clip, called "bar"

And there's a variable called "Points"

Whenever we get 2 points, the MC called "bar" is moves 1 frame.

To summarize: Whenever variable "points" increase by 2, "bar" MC's frame increase by 1.

View 4 Replies

ActionScript 3.0 :: Choosing An Array Based On Variable?

Apr 26, 2009

I have several arrays:

Code:
arrayEquipment
arrayBoots

[code].....

View 3 Replies

ActionScript 2.0 :: Load Certain Jpg Files Based On A Variable

Nov 1, 2003

trying to make this load certain jpg files based on a variable, but I can't make it loop through?

[Code]...

View 4 Replies

Actionscript 2 :: Function's Local Variable Through A Concatenated Variable String?

Mar 7, 2012

how you would target a function's local variable through a concatenated variable string.For example:

var txt = "Hello World";
function testing(msg) {
var test1 = msg;[code].........

I'd expect the trace to be "Hello World" but rather is given "undefined". So if variables created outside functions are created on the main timeline, where are local function variables created and how would you access them?

View 2 Replies

ActionScript 2.0 :: Variable In LoadMovie Function - Load A Variable That Contains An Url To An Image

Jul 28, 2007

I'm trying to combine PHP/SQL and Flash. I've got a problem now. I want to load a variable that contains an url to an image. so the variable is like this: [URL] Now I want flash to load the image, not the text. The variable is called 'img1' but the loadmovie function doesn't work when I put it in.

View 2 Replies

Flex :: Accessing Node In ArrayCollection Based On Variable Value

Nov 2, 2010

I need accessing a value in my arrayCollection in Flex 3.
var f:String;
I need to access the photoFilePath where series = f. So if f=2, then I need /pics/my2.png
So, pseudo code: myAc.(series="f").photoFilePath
<mx:ArrayCollection id="myAC">
<mx:Object label="Label 1" series="1" photoFilePath="/pics/my1.png" pageTitle="First"/>
<mx:Object label="Label 2" series="2" photoFilePath="/pics/my2.png" pageTitle="Second"/>
</mx:ArrayCollection>

View 1 Replies

ActionScript 3.0 :: Setting A Variable Based On The Response From A Server

Nov 11, 2010

I'm making a game that is tightly integrated into a rest service. I want to set variables based on what the server tells me the variable should be.

[Code]....

but then the parseUserRank() method can't directly return the value to userRank, so there would have to be an event dispatched when its available, then update then finally update the variable value....

View 1 Replies







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