ActionScript 3.0 :: Pass Value Between Class?
Dec 16, 2010Let's say I have two as generate.as and receive.as how am i going to pass a variable from generate.as to receive.as?
View 5 RepliesLet's say I have two as generate.as and receive.as how am i going to pass a variable from generate.as to receive.as?
View 5 RepliesI have a custom class created by a main document class, and I want the custom class to run a function in document class after some time.
How can I sent the instruction from custom class back to the document class?[code]...
The question is a bit silly. I am trying to implement a skill updating system. So to explain.There is a class
class AppInfo
{
public static var power:int = 10;
[code]......
I have a function:
PHP Code:
function getInfo (){
cardDetails= new Array('v','a','r','i','o','u','s');
var parent_mc:CatProcess = CatProcess(this.parent);
parent_mc.addForm(parent_mc.finalCardScreen,cardDetails);
parent_mc.removeChild(this);
}
this accesses a function of the parent movie clip - addForm which is:
[Code]...
This then adds an instance of the class finalCardScreen before removing itself. I want to be able to pass cardDetails array through to the new screen. I don't know what to put in my addForm object to do this though because I don't want to do anything with it just now, just pass it through to the class that is being attached.
I have seen this code in ultitouch gesture samples. But I don't kno how can I pass a bitmap parameter to the statement [Embed(source="imagenes/prueba.jpg")], how can I use this code with other bitmaps using parameters in this class?
package
{
import flash.display.Bitmap;
import flash.display.Sprite;
[Code]....
Is there a way to pass a Class as a variable in Actionscript 3.0? For example:
[Code]...
I want to pass some image names and numbers as string to my flash, so in html file I have [code]...
View 1 RepliesI want to declare a webservice in .mxml and pass it to a function in a separate class. The problem: callresponder's lastresult never gets updated when the call is succesfully made.[code]...
View 1 RepliesI am newbie in the actionscript, and i don't know how to pass a variable from one class to another![code]...
View 2 RepliesI'm trying to pass an xml node from one class to another and still be able to access that node's properties with no luck. I'll get right into the code for everyone though:
[Code]...
I am trying to pass XMLList from one class to another class using public function get.
Below is the code I am using.
XMLContents.as
ActionScript Code:
package com.ad.loading
{
/**
* ...
[Code].....
The problem is I get a "null" on trace.
I have an application that gets its variable data in XML file.
This application is used for different clients with different data.
Some of the data I pass to the Document class from the first frame. I would prefer to pass url to the XML file the same way, without the necessity to update the document class. But now I have to hardcode this url in the class every time, because I cannot get parameters from the first frame to the class at once, only after some time (like after loading XML with hardcoded url).
Is there a way to force executing of the code on the first frame before the code in the class will proceed?
I have a main swf that loads different swfs files, one of this swf files is the homepage with navigation items, how can I pass a reference to the loaded home.swf of the main.swf which contains the load methods?
I try creating a var in the home.swf class with the main.swf class type, but the home.swf give me errors that cant find other objects contains in the main.swf
I want a way to pass a string statement from one base class to an other. The two classes are CLICK and READ.What's an easy way to do this? I haven't worked in classes that often to know some of the simple tricks.
[Code]...
I have an array in a timeline that I need to pass to a class file, but I can't seem to figure out how to do this, as the method of inter-class array transfers doesn't seem to work.
View 1 RepliesI am wondering if it's better to pass an instance of a whole class to another class or just specific properties of that class. For example if I want the height property of class A in class B do I pass just the height value into class B or the whole instance of the class and use classA.height in class B?
View 3 RepliesI'm trying to pass my object class as constructor argument. I have something like this:
package myclass {
import flash.display.MovieClip;
import flash.display.BitmapData;
import flash.display.Bitmap;
[code]....
Now, when I try to create my Example:
import myclass.Example;
var example:Example = new Example(myObjClass);
I get message, that I'm not passing any variable (Error #1063). Why is that? What is wrong with it?
I have written a class that works fine, but as soon as I try make it re-usable and pass a parameter. It gives me this error "1120: Access of undefined property xmlList_0."
Here is ActionScript Code:
package Classes{
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class Carousel extends MovieClip {
[Code] .....
This is the code in my fla.file to run this class:
ActionScript Code:
import Classes.Carousel;
var carousel:Carousel = new Carousel(xmlList_0);
addChild(carousel);
I want to pass values to document class's constructor form html while embedding.
View 2 RepliesI ran into a problem today. Since I wanna pass a class name as a function parameter. In that function I wanna make instances of that class,
View 3 Replies[Code]...
Specifies the value of thisObject to be used within any function that ActionScript calls. This method also specifies the parameters to be passed to any called function. Because apply() is a method of the Function class, it is also a method of every Function object in ActionScript. i don't get how "thisObject" is accessible from within the function invoked with it's apply method i'm trying to pass the scope of one class to the function of another so that the keyword "this" in the target function refers to the passed scope or am i misunderstanding the apply() method? it appears to behave differently between as2.0 and as3.0 as well, try this example code from the adobe docs
[Code]....
how i can pass parameters to an instance of a class using the Object.registerClass method. It seems i can only put the name of the class but no extra parameters.
View 3 RepliesI have a combobox that I need to style with colors from xml. I call this XML file in the same class that has my combobox instance and break out the color I need to a var.
I then use MyCellRenderer (a class that extends CellRenderer) to style the drop down list items like so:
Code:
myComboBox.dropdown.setStyle('cellRenderer', MyCellRenderer );
This all works perfectly with a hardcoded color already inside the MyCellRenderer class.
My problem is when I instantiate MyCellRenderer and try to pass the color through I get the following error when I click the combobox open:
Code:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at fl.controls::List/drawList()
at fl.controls::List/draw()
at fl.core::UIComponent/callLaterDispatcher()
Is it possible to instantiate a class that extends CellRenderer? If not why not?
how can I pass a variable to my custom CellRenderer class?
I have recently moved from AS2 to AS3 and I am finding the transition fairly easy, however I do have a few questions, some of which may not have been possible with AS2 but I would like to achieve them in AS3
1. Is it possible to pass the name of a class as an argument in a function and then use it to create a new instance. e.g [code]
2. Carrying on from the previous question, if a class can infact be passed, can I specifying a variable type for the argument so that only classes and not instances will be accepted?
3. I have three class files that all inherit some functions and variable from another class called Ship. Is it possible to specifying a variable type so that the variable can only hold instances of classes that are inherited from the Ship class?
I'm creating a flash project and would like to pilot the most variables (eg: colors, texts, sizes, ...) from a single XML file and then spread them in my document class.
Code:
public var yourName:String;
public var myXMLLoader:URLLoader = new URLLoader();
public function intro():void {
[Code]....
Right now I got no errors but I got nothing when tracing the "yourName" var.
I am creating a class to handle some audio in an app I am building. This class will need to accept the XML element path as a passed parameter and or a getter.
examples of some XML elements I would like to pass to the the audio handler class to access them.
Dialog.introScreen.text
or
Dialog.secondScreen.main.text
ect.
I pretty sure this is not a string data type and thus cannot be passed as a string (I could be wrong though), if not, what data type would I pass it as?
I have a document with main class.I also have some movieclips which have their own class and functions.I am trying to pass a variable from my main class to one of these MovieClips.I tried some stuff, nothing worked.
View 11 RepliesI have a class (ImageLoader) that extends Sprite container and loads an external image to its instance. When i instantiate an object of this class from another (Main) class i want to have the dimensions (width, height) of the loaded image being known to this (Main) class. It seems that is difficult for me as the dimensions are known after the image compete loaded. But i don't know how to pass this information from completeHandler event handler to the Main class.
package
{
import flash.display.Sprite;
import flash.events.Event;
[Code].....
I want to pass through configuration arguments to a class. These are all the optional vars that go into configuring the class - and should be able to run in any order.
at the moment i just pass through the optional vars the regular way. Supposing the constuctor was like the following:
private var _reqVar:String;
private var _optVar1:String;
private var _optVar2:String;
[Code].....
assigning the argument to the var of the same key (i know in php to reference a variable name from a key you can use $$key = $value, is there an equivalent in as3?) display an error (using the 'throw' method) for variable names not supported by the class
In Flash CSn/AS3 you associate a Main class with a flash file which when loaded in the flash player "automatically creates an instance of the program's main class."I'd like to know how to pass arguments to the main class, since you don't write it yourself (you put its name in the Document textfield in the IDE).
View 1 Replies