ActionScript 3.0 :: Access An Int Of Separate Object?
Aug 17, 2009
I have a class whose primary purpose is to create and manage other classes in my game. One of its variables is an int that keeps track of the players money. It is also creating towers which are objects of their own. However the tower classes that it creates need to have a way of accessing the money integer (so they know if the player has funds for upgrading them)
View 3 Replies
Similar Posts:
Nov 11, 2008
Inside the attached .rar Two seperate objects are made, object A and object B, but they share the same variable (only works with arrays) even though they aren't linked in any way. Any changes made to A is reflected in B, and vise versa.
How would I go about fixing this issue? (SIMPLY, aka I don't want to write a class or whatever, I just want to know if I am doing something wrong, like not writing new or something)
View 2 Replies
Oct 26, 2009
I'm practically new to flash and action script and i'm currently trying to code something. I have a *.fla file with a dynamic text..I created a separate *.as file for the action script. My question is how can i reference the dynamic text properties? for example if i put the following code on my *.as file dynamic_txt.text = "place your text here" this will produce 1120: Access of undefined property dynamic_txt..How can i reference the dynamic text on my *.fla from my *.as?
View 21 Replies
Sep 30, 2010
When I try and access a function in a separate class, I suddenly lose access to all root access in that class.Heres some code.EnemyBase
ActionScript Code:
package
{
[code]....
View 9 Replies
Apr 16, 2011
you've shown me exactly what i need
View 6 Replies
Mar 5, 2010
I need to fetch a flex application from a process in C#.
How can i get access to the externalInterfaceAPI when the flex application is running as a Application?
EDIT: After further reading it looks like it is possible, as from what i understood, a flex stand alone application is a ActiveX "container", so what i need is to get access to the ActiveX container, and from there the externalInterface API.)
View 1 Replies
Oct 20, 2010
It's too complicate to explain but I'll give you an example
I have an AS3 ResultEvent Object and this object has several propeties which can be accessed by this like:event.result.name or event.result.age and, I have this String variable: eventProperty:String that contains "name" or "age" How do I access to event.result. with the variable?
View 2 Replies
Aug 28, 2009
bit of an odd problem, I have the following piece of code
Code:
var myCookie:SharedObject = SharedObject.getLocal("mySavedData","/")
if(myCookie.data.mySavedText != undefined)
{
var gallerypath:String = myCookie.data.mySavedText;
}
which retrieves a shared data.
If I put this actionscript on the first frame of a new document, it works fine, however I want to use it in something I already have, which uses an external Document class.
[Code]...
View 1 Replies
Oct 7, 2010
I am creating a fish-eat-fish movie and I need some help. I created a fish (pike1) that follows the mouse. Another fish (Chub) is set to disappear when clicked.What I want to do (and need help with) is to have pike1 grow larger (either by just growing larger or having pike1 disappear and be replaced on mouse click by a larger pike (pike2) when the user clicks on Chub
View 1 Replies
Apr 18, 2010
What I need to do is assign 5 separate dynamic text fields to 5 seperate buttons and at the same time to those same five buttons i would like to add 5 images that i would be able to change merely by swapping out the images in the file theyre in on the server.I would also like to get a nice transition between the images...ALSO i want to dynamically load the images for the buttons that will be used for switching from picture to picture(which im thinking i will be able to do after i know the how to do point the aforementioned things.)
Through tutorials I've found around the net I've been able to get most of the parts together... but i get lost because what they show you for AS2 they don't for AS3 and vice versa, at least that ive seen.so... I guess my question is... would i need to set up 5 seperate dynamic text fields on the stage and then set each one of them to one of the corresponding button. If so what AS code would i need to use to do so. And if not what would i need to do?
The other part of the question would be I know about the UILoader... would i be able to use it as my buttons and images, if so would i need 5 seperate ui loaders for both the Thumbnail buttons and the images or is there a way that would be better to do it? and once i do that would i do the transitions using frames and tweens like with AS2?
View 2 Replies
Aug 19, 2009
If I create a new flash AS3 file and create two blank keyframes in my actions layer I can add actions to each keyframe separately no problem. I can then easily switch between the actions frames from the menu bar on the left of the actions input panel. However if I try and do this on any of my projects i've been working on for a while when I create a new blank keyframe in the actions layer and try to add actions to it, I get sent straight back to my first actions keyframe and not a nice blank page. Can I even apply seperate actions to seperate keyframes?
View 6 Replies
Jan 17, 2011
This is NOT the same as my last thread as i am after three and NOT ONE as last time. In the attached movie there are three seperate movies loading into three seperate tweens. Please note that i am happy with this movie as it is, and do not want to change anything about it except for the script itself. It refurs to three seperate clips "b.a","d.c" and "f.e". What i want is for the script to incorperate all three clips under one name of "mc" And instead of have three seperate widths, "width 1","width2" and "width3" i want the script to also incorperate all three widths and heights into just one name of "width" and one name of "height".
View 9 Replies
Jan 7, 2010
I am developing an application with Flex for the GUI and Restlet for the webservices. I have a strange problem. I put my XML as a property on a generic object, and send it as part of a POST request. But in the Restlet webservice, this XML is irretrievable. How do I retrieve it? I tried initialising the received Representation object to a DomRepresentation, but thats not working. If I put the received Representation object into a Form object, then getFirstValue is returning that XML as a string! I noticed that the contentType of the HTTPService was application/www-form-encoded so I set it to application/xml and its not helping either. I use restlet 2.0m6 and here is the code snippet that I use -
[Code]...
View 1 Replies
Jul 23, 2011
i am trying to access an object within a class and the object is comming up as null but i dont understand why.
this is the object:
btnLMain = new MovieClip(); //variable declared earlier in code
btnLMain.name = "btnLMain";
[Code].....
View 2 Replies
Jul 23, 2011
i am trying to access an object within a class and the object is comming up as null but i dont understand why.this is the object:
btnLMain = new MovieClip(); //variable declared earlier in code
btnLMain.name = "btnLMain";
btnLMain.clickNum = 0;
addChild(btnLMain);
this was created in the class: LanguageButton. here is how i declared the above class within the class i am trying to instantiate it:
var btnL:LanguageButton;
then i try to access the btnLMain from the LanguageButton Class and it, (btnLMain) is comming out null:
btnL = new LanguageButton(cssLoader);
main.addChild(btnL);
btnL.btnLMain.addEventListener(MouseEvent.CLICK, btnLClick);
View 2 Replies
Jan 18, 2011
So I have two movie clips linked with classes- one with the class "theList" and one with the class "challengeBar". I need to use a function in challengeBar to access a function in the theList. They are both immediate children of the stage.so for now I have this (in the challengeBar class)-
public function populate(){
this.textBox1.text = myList.dequeue();
}
should it be something along the lines of root.myList.dequeue? or stage.myList.dequeue? How can I access that function?
View 2 Replies
Mar 15, 2008
I have been at this for about 19 hours straight! I am going to go to bed immediately after this post, but for crying out loud, I have NEVER had this problem before today! Before anyone reads ahead and says 'you have to attach your sound object to a completely separate mc to be able to control it independently from all other sound/root volumes.' see if the following code accomplishes just that:
[Code]...
View 2 Replies
May 31, 2009
I have problem with accessing object created by function imported from another package.
I have 2 packages DragDrop and UserInterface. In UserInterface I create methods for buttons and later add them in DragDrop . I make it in two different ways:
One(this one works):
[Code]....
View 6 Replies
Jun 22, 2010
I'm trying to set up a menu. Because this menu can have a varying number of entries, I'm generating it instead of hard-coding it. The Menu object contains an Array of MenuEntry objects, and each MenuEntry has a framework.Button object which contains the text and box that actually gets drawn to the screen. I can add a MouseEvent.Click event to the Button, but not the MenuEntry. If I do it that way, though, I'm unable to access the data in the MenuEntry object that contains the button, so I don't know which MenuEntry was clicked.
The only solution I can think of involves checking the mouse position against the position of each MenuEntry, depending on the number of Menu Entries. This does not seem like the right way to do it, though, as it is not scalable. I tried having the MenuEntry class extend the Button class, so theoretically, the MenuEntry itself could dispatch mouse click events, but that didn't work.
View 1 Replies
Mar 12, 2012
I have tried for days to solve this. I am trying to access the "newsData" object from my .fla to populate my manually created textfields.
Here is the class:
package {
import com.adobe.serialization.json.JSON;
import flash.net.URLLoader;
import flash.net.URLRequest;
[code]....
View 9 Replies
May 4, 2011
In order to have accees to the parsed XML does all my code that needs access to it have to be within the displayResources function?? I'm trying to load some XML outside f the function and it aint workinnnnn.
XMLParser.load("Q_data/string_assets/string01.xml", onFinish, null, false, true)
function onFinish($success:Boolean, $parsedObject:Object, $xml:XML) { //This function gets called as soon as the XML loads and gets parsed. if ($success)
[Code]....
View 5 Replies
Feb 4, 2012
I have a circle as movieclip in the settings and a fex controlls (up,down,left,right).I dropped all controlls and the circle and press on a button to add some actionscript.[code]When i click on the controll nothing happen.
View 2 Replies
Jul 29, 2009
In FFishScript:
function customObject () {
this.property = 123;
this.getProperty = function() {return(this.property)}
}
[Code]...
What is the best way to access FS object from Actionscript?
View 1 Replies
Aug 4, 2009
I have MCs loaded from the Fla library through my main class. These are drag objects. When one of these is clicked, I want the player to run a function that will disables some based on one selected. When I tried the obvious reference, I had an error. I've been advised to add these to an array, but I can't even do that.
Code:
import HO_42;
I set the objet to a variable above the constructor function:
Code:
private var office:HO_42;
The constructor calls a function that loads the objects to the stage (and this works fine if I don't try to access the object), here is an example of the load and access code:
Code:
office = new HO_42();
addChild(office);
office.x = 441.9;
[code].....
View 16 Replies
May 28, 2010
I have an object, and I want to access it's property, but I'm passing the name dynamically... so instead of referencing person1Properties I'm trying to reference ("person"+id+"Properties)...
[Code].....
View 7 Replies
Aug 18, 2009
I try to access to the class of an Actionscript Object like the method getClass() in java.
example :
I have this class with a method 'myMethod(clazz:Class)'
public class Class2
{
...
public function myMethod(clazz:Class):void
[Code].....
View 3 Replies
Jul 29, 2009
I have an object, myObj, that has no key/value pairs, only elements. When i trace it out i get the elements listed inbetween curly braces {item1, item2, item3, item4} I can access the first element by calling myObj.first( ) and I guess there are other methods I could try to call on the object - such as myObj.last( ) - but I can't seem to access the other elements in the object. I would like to be able to do something like:
[Code]...
View 5 Replies
Jun 27, 2010
Anyone know how to access a var name dynamically with an object? I need to be able to get myObject.objValue1. But I want to go through a whole bunch of them in a for loop from value 1 to 50.
View 1 Replies
Oct 7, 2010
how to access data from object I instance on stage?Inside class XmlParser I have function that parse some XML:
ActionScript Code:
package src
{
import flash.events.Event;
[code]...
And I instance object on stage using:
ActionScript Code:
var xmlInstance:XmlParser = new XmlParser(xmlData, 0);
trace (xmlInstance);
//trace outputs [object XmlParser]
I`d like to access data in holdXml variable from stage.
View 9 Replies
Jan 11, 2012
So ive made a custom message system for my game and the scrollpane component requires me to have the info inside one movieclip. I have a couple of textfields there that i want to change to some variables on demand. The vars are in an external as file and im able to reference them well on the main timeline. The problem is when im inside the scrollable object, all the vars return blank instead. This is the code which is placed inside the object:
Code:
import Variables;
var variables:Variables = new Variables();
function setMsgSlot (e:Event) {
[Code]....
View 0 Replies