ActionScript 2.0 :: Basing A Numeric Variable On A Loaded Variable?

Dec 21, 2009

Working in AS2, using CS3 Flash Pro I've simplified this to just the one little thing I'm trying to do.

countervariables.txt has this text in it:

[Code]...

The trace shows itemsPerMili as 'NAN' and totalForYear as 'undefined'. I know itemsPerMili yields 'Not A Number' because totalForYear comes up undefined, but oddly, the loaded variable does show up correctly in a dynamic text field assigned to the variable. I don't understand why it should show up in the dynamic text field correctly when it won't trace.

I want to see the number "3.80517503" in my trace for itemsPerMili.

View 3 Replies


Similar Posts:


ActionScript 2.0 :: Numeric Value Loaded To Variable From Txt File?

Nov 1, 2006

Why can't I assign a numeric value to a variable from a variable in a text file?

text file contains HowManyBands=3

actionscript is as follows:
loadNumVar = new LoadVars();
var NumOfBands:Number = new Number();
loadNumVar.load("Performers.txt");

[Code]...

within the if statement, the trace reports 3, however, if I try to use the variable later or trace it in the next frame of my video, it thinks it's 0. How can I get the Variable to hold onto the value throughout my animation?

View 3 Replies

ActionScript 2.0 :: Specifying Number Of Decimals To Display On A Numeric Variable

Mar 28, 2007

An onLoadProgress listener object is returning a variable I am using to tell the user what percentage of the movie has been loaded. I am happy with the results of

Code:
myListener.onLoadProgress = function(empty10MC:MovieClip, loaded:Number, total:Number):Void{
//setText();
var percent:Number = loaded/total*100;
loadingTxt.text = beginTxt + percent + endTxt;

however the number returned is like 15 digits long! Is there any way I can limit the variable to display only 1 or 2 decimal places?

View 3 Replies

ActionScript 2.0 :: Create A String Variable...and Then Use The Value Of That Variable To Declare Another Variable?

Jan 3, 2006

f you know PHP...then you know that you can create a string variable...and then use the value of that variable to declare another variable. like this:

PHP Code:

<?php$foo = "haha";$i{$foo} = "success";print $i{haha};?>

and it would display "success"...or like this:

PHP Code:

<?php$foo = "haha";$$foo = "success";print $haha;?>

and it would also display "success".

View 6 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 2.0 :: Variable + Variable = Variable. Sort Of?

Aug 29, 2007

Code:
var fruit1:String = "apples";
var fruit2:String = "oranges";
var fruit3:String = "grapes";[code]....

I need the variable fruit1, but for reasons I don't have time to get into, I don't know how to parse these two variables to make a parseable variable.

View 1 Replies

ActionScript 2.0 :: Get A Variable Value From The Url In Which Its Loaded?

Mar 20, 2009

Is it possible for my swf to get a variable value from the url in which its loaded?

Example: If 'mypage.swf' is loaded in 'mypage.html' and its url looks like this:[URL]...then, is it possible to get the value of 'myvariable' from inside swf?I tried using this code on the first frame of my swf:

Code:
var myurl= this._url.split("?myvariable=");
var urlvalue=myurl[1];
... but it shows undefined

View 4 Replies

ActionScript 3.0 :: Accessing A Variable Loaded From Another Swf?

Sep 15, 2008

I have a problem accessing a variable loaded from another swf. Actually the variable is a singeltone class, which needs to be initialized.It has structure presented in the last part of the message.The project has the following structure:

- main.swf - this loads all the other swf files and is their holder.

- assets.swf - contains some common elements and initializes the SingleTone class

- interface.swf - contains some interface elements and needs to use the SingleTone class

- all the three swf files have access to a common class structure, where the SingleTone class is defined.

Now, the problem I have is accessing the SingleTone class from the interface.swf file. If I try to send the SingleTone.singleTone. property parameter to the class I get "Type coercion failed: cannot convert from ClassName@.. to ClassName". If I try to access the SingleTone class directly from the interface.swf file i get "Cannot access a property or reference of a null object...". Both errors I get seem logical:

- if I send a parameter, I send the reference to that object, but the interface.swf file does not have access to the assets.swf domain;

- if I try to access the SingleTone class directly from the interface.swf file, I get the null error because the class is not initialized over the interface.swf domain.

Is there any work arround? I know a simple solution may be to initialize the variable over the interface.swf domain, but what if there is a variable that can only be instantiated in the assets.swf? Can I access that variable from another swf, or can I change the ApplicationDomain?

View 1 Replies

ActionScript 3.0 :: Use A Variable In A Swf Loaded Using Loader?

Jul 2, 2010

I am sending a variable from my main swf into a loaded swf using the following code with its output at the bottom.I am having trouble getting my Course_ID_NO variable out of the function "inputid" in the loaded swf.

//-------Main swf
course_begin.addEventListener( MouseEvent.CLICK,cb_btn_click ); function cb_btn_click (e:MouseEvent):void { var mc_course:MovieClip; var request:URLRequest = new

[code].......

View 7 Replies

Retrieve The File Name From A Variable Loaded With An Swf?

Feb 25, 2012

I am trying to place a condition statement so that it will only do an action if the swf loaded into the varaible is the same or empty. I start of with loading the sample1.swf into the movieclip swf_holder

Code:
var loadSwf:Loader = new Loader();
swf_holder.addChild(loadSwf);
loadSwf.load(new URLRequest(sample1.swf));
loadSwf.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);

In order for me to get the sample1.swf to play, I create a variable so that I can just call on it

[Code]....

View 1 Replies

ActionScript 2.0 :: How To Use Externally Loaded Variable

Jul 17, 2010

I have loaded a variable in a text file using the following code:[code]So, my text file has the variable called "volumes" and it loads into a text field named whose instance name is "ggg".Now the variable volumes is a number, and I want to use its value to determine the number of time a loop runs. Here is the code for that:[code]But this doesn't work. However it works if I define the volumes variable inside ...

View 1 Replies

ActionScript 3.0 :: Use A Parents Variable In A Loaded Swf?

Mar 5, 2011

Seems simple and I've searched but can't find the answer to this simple problem.

Loading map-.swf into main.swf. I want to use a variable from main inside map-1 to indicate which xml file to load.

First problem, I'm coming to AS3 and if a variable isn't declared, then errors, can't compile. So do I have to declare this variable in both swf files?

And well I've tried declaring the variable in the loaded swf and it still doesn't work.[code]...

View 3 Replies

ActionScript 2.0 :: Redefine Variable After XML Is Loaded?

Jul 27, 2004

i am using claudio's scrollbar to scroll an rss feed (compiled into an XML file). i have a variable h2 which is equal to the height of a box within the movie clip containing the scrolling content. the height of the box is equal to the maxscroll of the externally loading XML file. the box *does* resize properly (tested with trace), but only after the variable h2 is already defined... so variable contains the original size of the box and not the new size. how can i get the variable to update so that the entire external file can be seen with the scroller?

View 2 Replies

ActionScript 2.0 :: Set A Variable Before The New Movie Gets Loaded

Dec 27, 2004

I have this dynamic menu that loads data from a xml file and loads a coprresponding movie. BUT, is it possible to set a variable as well OR instead so before the new movie gets laoded I can play something like a outro mc, check variables and then load the new mc?? Here`s the code:

[Code]...

View 2 Replies

ActionScript 3.0 :: Accessing Loaded Swf Variable?

Jun 24, 2009

I have successfully loaded an external swf inside my main swf. Now, I'm unable to try to trace a variable of the loaded swf from my main swf....

Code:
// Create site request
var siteRequest:URLRequest = new URLRequest('site.swf'); // 'site-' + siteAmbiance + '.swf'

[Code]....

View 6 Replies

ActionScript 2.0 :: Variable Assignment From SWF To Loaded SWF?

Apr 7, 2005

I have been playing with this for a day and haven't been able to figure out the proper path to load this variable.So I have a main movie, a menu (movie clip) in it, and each menu option loads an external swf in a movie clip instance (called content) in the main movie.Loading the movies works fine.My problem is I want assign a variable that I have declared in a loaded movie in the 'content' instance.

Main Movie
|
- Menu (MC)
-onrelease -loads movie.swf, assigns defaultpage var a value

[code]....

Here is the onrelease code I'm using

on (release) {
this._parent.content.loadMovie("company.swf"); //this works
this._parent.content.defaultpage = "somevalueinhere"; //this doesnt
}

View 5 Replies

ActionScript 2.0 :: Where Does 'loaded' Variable Get Set To False

Mar 29, 2004

url...Where does the 'loaded' variable get set to False?I could only find it being set to True on the enterFrame function.Also, is there a more updated way to do what this tutorial is showing?

View 4 Replies

ActionScript 2.0 :: Check When A Variable Has Been Loaded?

Nov 29, 2002

Can i check whether an external file exists?

I'm using this code to get the data from a file:

loadVariables(fileName.txt, outputBox); //outputBox is the instance name of the text box

i'm not loading any variables as such, but dumping the text in the file straight into the textbox

now i want to check if fileName exists

View 4 Replies

Javascript :: Pass The Variable So That The Resulting Line Of Code Doesn't Have The Quotes Around The Variable Value?

Oct 3, 2011

I'm trying to pass the contents of variable playnoyes to the long line of code below to decide whether or not to autoplay the flash movie, but doing it as I have below, the resultant line of code has the variable in quotes and therefore the code doesn't execute it as expected. My question is, how can I pass the variable so that the resulting line of code doesn't have the quotes around the variable value.

var playnoyes='true';
var testtext = "<script type='text/javascript'>AC_FL_RunContent ('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.[code]....

View 3 Replies

ActionScript 2.0 :: Flash8 Variable Set-up - 'if' Statement To Run From Variable When Playhead Encounters MovieClip

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

Flex :: External SWF Variable Updates Global Variable In Main Timeline?

Feb 8, 2010

I have 2 movie clips, one being loaded into a container MC via "loadMovie();"In the main movie there is a variable with no value, in the external movie there are 5 frames, each with a value to update the variable in the main movie.

IE: if on frame 1, global value = 1 / if on frame 2, global value = 2 / etc etc I'm familiar with passing variables INTO an external swf, but am stumped on how to do it the reverse way.

View 1 Replies

IDE :: Load Panghat Spa.swf As A Variable By Pasing Variable From Html Page In To Flash

Sep 15, 2009

var loader:Loader = new Loader();
loader.load(new URLRequest("panghat spa.swf"));
addChild(loader);

want to load panghat spa.swf as a variable by pasing variable from html page in to flash

View 1 Replies

ActionScript 3.0 :: Combine Multiple Variable Names Together To Target New Variable?

Jan 31, 2012

I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).

My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.....)

I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.

Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)[code]...

View 2 Replies

ActionScript 3.0 :: Variable Of Null Value Assignment To A Variable Or Instance Flash?

Jan 7, 2010

As we know whent here is no such variable of null value assignment to a variable or instance flash throws this kind of Error.In one of my Application i need to get more flashVariables, They may or maynot come as FLASHVARS. But when i miss any variable flash thows this error as an alert box. is there any simple solution to avoid this kind of issue
 
when i use try,Catch statement the issue will not come, But i don't like to write Bunch of try,catch statement for all this kind of variables.

View 4 Replies

Flex :: Store ColorPicker Value In A Variable And Bind The Variable To A TextInput

Dec 11, 2009

I would like to store a hex colorPicker value in a variable and then cast the value of the var backout to a textInput. The textInput is just to see witch hexcolor i have choosen.

thus meaning seeing 0x000000 in the textInput.

what i've done now is pretty simple i have bound the flex colorPicker directly to my textInput. but i want to store the value from the colorPicker in a var first and than spit it backout to the textInput to see the value that i have picked.

When i pick a color value that begins with the number 0 it drops the 0's at the beginning of the number and only spits out the numbers greater than 0. (000033 becomes 33, FF0000 stays FF0000). I want to catch the whole value or write some kind a function to figure out how many 0's got dropped and concatenate it together with 0x. Store that all into a var and bind it to the flex TextInput.

This is what i've got.

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"

[Code].....

View 1 Replies

Actionscript 3 :: Combine Multiple Variable Names Together To Target New Variable

Jan 31, 2012

I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).

My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.....)
I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.
Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)

So my buttons as well as loading the image have the event listener:

image1_btn.addEventListener(MouseEvent.CLICK, setCurrentSelection);
image2_btn.addEventListener(MouseEvent.CLICK, setCurrentSelection);
(and so on..)
function setCurrentSelection(e:MouseEvent):void {

[Code]...

So within the rotateClockwise and rotateAntiClockwise functions i need to be able to recognise which is the currently active loader and have that number instead of the X - so if it is image1_loader - it needs to be image1_content, if 4 - image4_content... I had tried to do it as this but it doesn't like it being a string:

rotateAroundCenter((activeLoader+'_content'), 10, ptR);

View 3 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 3.0 :: Defining A Variable As 2 Separate Things Depending On Other Variable?

May 4, 2011

I'm making a platform game where all of my level components (ground, background etc.) are within an array called 'levelArray' so I can move all the elements the same amount at the same time. I'm just starting to implement my second level, and I need to change 'levelArray' to contain different level elements. I've tried to put an 'if' statement to change the definition of the variable:

[Code]...

View 3 Replies

ActionScript 3.0 :: Combine Multiple Variable Names Together To Target New Variable

Jan 31, 2012

I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.)I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)So my buttons as well as loading the image have the event listener:[code]So within the rotateClockwise and rotate Anti Clockwise functions i need to be able to recognise which is the currently active loader and have that number instead of the X - so if it is image1_ loader - it needs to be image1_content, if 4 - image4_content.I had tried to do it as this but it doesn't like it being a string:[code]

View 3 Replies

ActionScript 2.0 :: Use Variable And Test It With Trace, The Variable Shows As Undefined?

Jan 13, 2004

we have this variable from the internet, val(0), in a dynamic text field we can see a digit from this variable. but when we use this variable in actionscript and test it with trace, the variable shows as undefined.how can we make this work without it coming up as undefined??

View 12 Replies







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