ActionScript 3.0 :: Read Variable In A Different Class?
Jan 15, 2011
Basically, imagine two classes, for simplicities sake I'll call them classA and classB they are in the same folder, same project, and all variables have been called as public.
In classA there's a variable, for this example I'll call it speed (its called something else obviously as speed alone turns blue so its a reserved word). It is made and updated in classA for it's current value
classB handles the array to move things, and needs to reference what speed is so it knows how much to move each object each tick.
How do I allow classB to look in classA and see what the current value of speed is?
View 4 Replies
Similar Posts:
Mar 20, 2009
How can I read a variable from URL so that it can be used in my swf? I have 'main.swf' loaded in 'mainpage.html'. I am using getURL to pass variable from this swf to the URL of another html page(secondpage.html)......
[Code]...
View 4 Replies
Jun 22, 2011
Try to read xml data into a variable to put it out in an
xml scheme
<akws>
<akw>
<name>test</name>
[code]....
now I want the number in <_5> into an s:Label
private function countpop():void{
popsum = parseInt(xmldata.akw[1]._5);
}
but
<s:Label text={popsum} />
gives me NaN?
View 1 Replies
Jul 28, 2007
I need to set a variable to the contents of an input box. How do I do this?
View 6 Replies
Sep 25, 2009
ActionScript Code:
var city:String = "Bath";
var xml:XML = new XML();
var urlloader:URLLoader = new URLLoader();
urlloader.load( new URLRequest("[URL]") );
urlloader.addEventListener("complete", xmlComplete);
function xmlComplete(e:Event):void{
[Code] .....
The main part is where I have created the variable: IconGif... it reads a portion of the xml file and turns it into a rference that will eventually relate to an instance name of a movieClip. I was going to use:
ActionScript Code:
this.attachMovie(IconGif,IconGif,100);
to place the item on the stage to whatever the xml says that day,
My problem occurs because the function I have used to create the variable, clashes with the attachMovie function and I receive the message:
TypeError: Error #1006: attachMovie is not a function.
at weather_fla::MainTimeline/xmlComplete()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader:nComplete()
Whatever that means but when I try to call the variable outside of the function, it doesn't know what I'm no about, because as far as it's concerned it doesn't exist, but only when the function is being called. I'm not the wisest with XML and calling up data...
View 8 Replies
Oct 28, 2009
I have a function that makes an array and I am trying to read the contents of the variable outside the function but it keeps giving me the result as undefined.
I know there must be a simple solution to what i am attempting to do.[code]...
View 0 Replies
Mar 27, 2012
How do I add a variable to a string and then read it?I have:_root.compassItem = 'Item';I have a movieclip that has an instance name of Item and it is inside the movieclip _root.mWorld.so I assume its instance would be _root.mWorld.Item.I want to get its ._y dynamically. How would I do this?I am trying: trace(_root.mWorld._root.compassItem._y); But, it is returning undefined.
View 3 Replies
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
Jul 9, 2009
I currently have a flash video player and I want to add some code that will update a variable in an external .as or .txt file. I then want to be able to pull this variable into a different .swf when required.
My variable I want to create will be CurrentVideo and it needs to be a number e.g. _global.CurrentVideo = 2
View 1 Replies
Mar 29, 2009
Given that there is a global javascript variable on my web page named myVar, how can I access the value of the variable myVar from within my flash movie using javascript?
I see plenty of examples of using external interface in order to execute javascript from actionscript, but I am unable to find examples of returning values back into the flash movie using actionscript.
View 1 Replies
Jan 14, 2011
What is the best way to have a flash text box read a PHP session variable? I want to do something like show a shopping cart total price in the text box which would be stored in a PHP session variable.
View 2 Replies
Apr 13, 2009
My html:
Code: Select all<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
[Code]....
Do I need another variable that flash can read? Not much documentation on any of this...
View 2 Replies
Jan 6, 2010
I am trying to send a php variable with one field from mysql. When I print the php variable on my php page it outputs the field, but when I try to send it to flash it doesn't output anything.Here is my php script that tries to send a mysql field to flash and there nothing is shown. It works on my php page, it outputs the mysql field.
$product=$result['product'];
$pro=$product;
$pro = "&pro=".$pro."&"; //~ make it a flashable variable
[code].....
View 2 Replies
Jul 3, 2009
in a flash template i found several buttons with almost the same action script code. on pressing the button a window popup with different text (for each button a unique text). the following code is in the code section of the buttons, only the two last codelines are different for each button.
[Code]...
so i think that the input of the unique text for each button is handled in the last line "_root.READ = 22". i also found in the bibliothek the belonging text parts. my problem now is that i dont know where the connection is set between the text part and the array/variable READ. in this case the connection is 22, but i dont found any property in the text part or in the property of the button where the connection is set to 22. i use flash cs4.
View 3 Replies
Sep 11, 2009
I have a number of checkbox's on the stage. The client would like the half dozen or so checkbox selections to be in a random order each time the frame is viewed. Simple enough, I created a random array...
Code:
var Q3Labels:Array=["17p deletion","p53 mutation/deletion","11q deletion","Trisomy 12","13q deletion"];
function getQ3Labels():String {
[Code].....
But when I test this code I get a "1084 Syntax error: expecting rightparen before .", so it seems it's reading Q3A as literally "q3a_chkbox.label" not "11q deletion" (or whatever). If I change the Q3A variable to simple text then it works fine,
View 0 Replies
Jul 28, 2009
I have a sample.txt file which contain a single word and I need to put this word into a variable on swf.[code]...
View 5 Replies
Aug 25, 2010
I declared a variable & it's value in the main timeline. Then I created a movieclip and have some actionscript inside that movieclip. Is it possible to read the varialbe's value within the movieclip?
Let's say I have this variable in root timeline var myVar:Number = 100; and I want to read myVar's value within a movieclip like following trace(root.myVar);
View 3 Replies
Sep 4, 2011
[code]...
how can i trace xox from my fla file ?(or how can i edit the variable from my fla file)
View 3 Replies
Jul 1, 2009
How can NetStreamInfo class's parameters be read. I mean, I have an application to perform live streaming. I have used 'nc' as my Netconnection object & 'ns' as NetStream object and nsi as NetStreamInfo object. When I Type 'nsi.' I see lot of attributes but when I try to print it using
[Code]...
View 7 Replies
Nov 2, 2009
Is there a way to make a property read only from outside of the class?
View 5 Replies
Jun 3, 2011
In my emptyMC, i'm calling a newsticker, that needs an external .as class to works propertly. But when it opens, it doesn't read my _x and _y coordinates and neither the .as.
My code to it, is in a frame:
Code:
this.createEmptyMovieClip ("noticias", 2);
loadMovie("newsticker.swf", noticias);
noticias._y = -50;
noticias._x = 0;
In my first frame I have locked the root with:
this._lockroot = true and i has been working perfectly.
Also in the root in a frame i'm loading a music.swf.
for further doubts, just ask.
I'm working with Flash CS5 and AS2, Flash Player 8.0. It's a TM template.
View 2 Replies
Jan 25, 2007
I need to parse and display the value for variable VALUE in xml to the screen but read from the file continuously instead of
once. The XML file is being created dynamically so its getting larger but flash only displays first value for variabel VALUE.
View 5 Replies
Oct 9, 2008
How to read a variable from main.swf (that load content.swf) and use it inside content.swf?
I have a variable called TextColor = "Green" in the main movie and I want to read this variable from inside the content movie?
View 5 Replies
May 18, 2011
I would like to read the source of the flash.net.FileReference class. Is this possible?Where can I find the source files, do the come with the Adobe Flash or Flash Builder?
View 4 Replies
Oct 12, 2010
i have a movie clip which is exported for ActionScript , i want to get a variable from the document class into the movie clip class i tried this but there was an error !!
ActionScript Code:
var main:Main=new Main();
main.txtScore.text="hello";
View 1 Replies
Feb 19, 2010
I realize this is kind of an odd issue, but I am wondering if there's any way to get Flash to allow me to access a class's static functions using a class variable that points to the class. Example:I create a class called FooClass that has a static function named fooI then create a variable of type Class that points to it
Code:
var class:Class = Class(getDefinitionByName("FooClass"));
However, when I try to call foo() using the variable, it errors saying the function
[code].....
View 6 Replies
Dec 28, 2009
I'm trying to create a class which will create a tween for several different instances of an object. I am creating the instances in the Document Class. The trick is, I would like to specify how long each tween will take.
Here's what I have so far:
DOCUMENT CLASS
ActionScript Code:
package {
import flash.display.MovieClip;
import mcCloud;
[Code].....
As you can see, I have a variable "myTime" which syncs the timer and the tween. This causes to tween to repeat and the clouds to continually scroll across the stage. How can I determine the var myTime at the time I create each instance of the Movie Clip mcCloud?
View 6 Replies
Aug 31, 2011
When I declare a class variable
private var myVar:MyClass = new MyClass();
It creates a new instance of that class that will trace as [Object MyClass].
However, as soon as I assign it to something
myVar = thisOtherVar;
It will now trace as [Object thisOtherVar].
I need to get it back to where it's just an "empty" blank class instance, if that makes any sense at all.
View 14 Replies
Mar 14, 2011
I've only been programming in as3 for a couple months, and so far I've written several compositional classes that take MovieClips as inputs to handle behaviors and interactions in a simple game I'm creating. One problem I keep coming upon is that I'd love to access the custom variables I define within one class from another class. In the game I'm creating, Main.as is my document class, from which I invoke a class called 'Level1.as' which invokes all the other classes I've written.Below I've pasted my class 'DieLikeThePhishes'. For example, I would love to know the syntax for accessing the boolean variable 'phish1BeenHit' (line 31) from another class. I've tried the dot syntax you would use to access a MovieClip inside another MovieClip and it doesn't seem to be working for me.[code]
View 1 Replies
Mar 14, 2011
I've only been programming in as3 for a couple months, and so far I've written several compositional classes that take MovieClips as inputs to handle behaviors and interactions in a simple game I'm creating. One problem I keep coming upon is that I'd love to access the custom variables I define within one class from another class. In the game I'm creating, Main.as is my document class, from which I invoke a class called 'Level1.as' which invokes all the other classes I've written.Below I've pasted my class 'DieLikeThePhishes'. For example, I would love to know the syntax for accessing the boolean variable 'phish1BeenHit' (line 31) from another class. I've tried the dot syntax you would use to access a MovieClip inside another MovieClip and it doesn't seem to be working for me
package jab.enemy
{
import flash.display.MovieClip;
[code].....
View 1 Replies