ActionScript 3.0 :: Cannot Pass Parameter To Already Written Class
Feb 5, 2009
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);
View 3 Replies
Similar Posts:
Dec 16, 2011
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]....
View 4 Replies
May 31, 2010
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?
View 9 Replies
Sep 10, 2009
I 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
Dec 28, 2010
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?
View 7 Replies
Nov 7, 2004
I have a class that has a constructor which accepts some parameters.
Code:
class MyClass {
var myNumber:Number;
function MyClass(number) {
myNumber = number;
}}
Is there a way I can link this to a movieclip and pass the parameter? From what I've found there are two ways to link the class to a movieclip, one using the registerClass and another typing the name intro the Linkage Box in the Library. But in both cases there are no parameters being setup.
View 2 Replies
Nov 15, 2009
i have a bitmap in the library with export name Dots
1. how do i take this and pass it to the class which expects a Bitmap as a parameter? if i load it externally i could say:
[Code]...
View 5 Replies
Jun 2, 2011
What is the difference between :
giving a function reference in the result attribute of the HTTPService class like this :
protected function httpserviceCheckUpdate_resultHandler(event:ResultEvent):void
{
var version:Number = event.result.text.version as Number;[code]....
If both of them are same then how can I provide the event parameter using the second approach (as written in the result attribute of the httpservice class)? Which one of them is the better way of doing things in FLEX.
View 2 Replies
Jun 16, 2011
I have a custom class being constructed from my main class. In the custom class it has another custom class that is passed in as a parameter. I would like to strictly type the parameter variable but when I do, 'the type is not a compile type constant etc'.This, I understand, is because the custom class used as a parameter has not yet been constructed.It all works when I use the variable type ( * ) to type the parameter.I suspect this is a design flaw, in that I am using an incorrect design pattern.It is actually hand-me-down code, having received a large project from someone else who is not entirely familiar with oop concepts and design patterns.
I have considered using a dummy constructor for the parametered class in my main class but the passed in class also takes a custom class (itself with a parametered constructor). I am considering using ... (rest) so that the custom classes' parameters are optional.Is there any other way to control the order of construction of classes? Would the rest variables work?edit)in main.as within the constructor or another function
var parameter1:customclass2;
customclass1(parameter1);
in customclass1 constructor:
[code].....
View 1 Replies
Aug 14, 2009
Forgive me for this stupid noob question but I want to call a function (loadList) that originally gets triggered after a mouseevent from another function (addToXML) that does not have an event.
The loadList function takes info from a XML var, sticks it into an array which then gets loaded into a tile list and that is working fine.
The addToXML function when called adds elements to the XML var after which I want to call the first function with the event parameter so it refreshes the items in the tile list.
I know it can do this by creating a new array and loading that into the tile list in the addToXML function, but it be much simpler to just recall the function.
I have tried things like
Code:
addToXML.addEventListener(Event.COMPLETE, loadList);
but all the event constants I have tried give me error messges like "1061: Call to a possibly undefined method addEventListener through a reference with static type Function."
View 3 Replies
Jun 17, 2009
I want to use some assets ( buttons, etc. ) I'm creating in flash in a flex actionscript project. Since all my assets are bellow 10K, I'm not planning to load a swf ,wait until it's loaded and create the interface. I want to use a swc and just instance the clips I need. Also, I want my Button class to have some extra properties, and this is where the problem occurs.
If in the Linkage Properties in the Flash IDE I add a reference to a custom Button Class and trace a child of the Button MovieClip, I get the right trace. If then I create a Button, in the Main class in Flex, using the generated swc file and trace the same child of the Button MovieClip, I get null. Why is that ? Is there anyway to get around this ? I've considered using the Flex Component Kit, but since I'm working on a simple actionscript project and I'm not using the Flex framework, I see no point in using the Component Kit at this point.
View 2 Replies
May 6, 2010
im having problems with the following code:
for (var i:Number=0; i<numFaces;i++){
var faceLoader:Loader = new Loader();
faceLoader.contentLoaderInfo.addEventListener( Event.INIT,
function(fle:Event){
[code]....
The problem is that im sending the variable i to the function LoadCara on every iteration, and its always called with the last value of i. I would like this function to be called with the appropiate index.
View 2 Replies
Jun 14, 2009
I'm trying to get a URL parameter in my flash...The parameter is a xml url...
testXML = new XML();
testXML.load(xmlurl);I tried every code I can find on the web and couldn't find a solution to get xmlurl
I tried var xmlurl:String = String(_root.loaderInfo.parameters.xmlurl); but it didn't work...
_global.xmlurl didn't work either
Here is my HTML:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="590" height="300" id="test" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="test.swf?xmlurl=data.xml" />
[code]....
View 16 Replies
Jun 21, 2010
When I create a custom component, I define a property which is array that could accept values from the enumeration, see code below:[code]...
I would like to know how I can pass array of values to my component from MXML application that uses my custom component.
View 1 Replies
Mar 14, 2011
How can I pass the keyword this OR an instance name as a parameter inside a function?
function (reference:InstanceName):void // kind of what I want
{
reference.gotoAndPlay("frameLabel");
}
View 2 Replies
Jan 18, 2012
I have an AIR application that is downloaded from a webpage. In order to download the application, one must be logged in. I would like the first time the user opens the application, to be able to acces the userId that was logged in.
Is there any way do pass that information?
View 2 Replies
Oct 12, 2008
I would like to pass a mouse event : MouseEvent.CLICK as a parameter.
example:
ActionScript Code:
activateEvent(MouseEvent.Click,clickedEvent);
function activateEvent(event:MouseEvent,destination):void{[INDENT]
[Code].....
View 6 Replies
Dec 19, 2009
I must be missing something obvious. I'm trying to pass a parameter from a URL into a text field in flash, but it doesn't seem to work. I've got a dynamic text field (display as html is checked), with an instance name txt_txt. Here's the only line of code in the file:
txt_txt.htmlText="test "+this.loaderInfo.parameters.nameVar;
And, when I upload it and use the following, I get "test undefined" as my return!? [URL]
View 0 Replies
Feb 24, 2012
I'm just looking for clarification on the passing of a parameter and why/how it works.
In this example, it looks like you create a parameter to be passed in called 'evt', but I don't see it used anywhere in the function. [code]...
View 9 Replies
Sep 20, 2006
explain with 1 example how to pass parameter from ASP to FLASH..or otherwise direct me to the right tutorial site
View 3 Replies
Jul 20, 2009
I have a hangup on very basic issue...I am trying to pass a parameter into a variable that gets passed into a function.
Code:
import flash.display.MovieClip;
import flash.events.MouseEvent;
var myBtn:String = myFunction();
[Code]....
View 2 Replies
Oct 6, 2009
Is it possible to create an associative array w/o using a variable to pass it as parameter to a function?[code]...
View 1 Replies
Dec 1, 2010
how to pass parameter to eventListener function.[code]
View 1 Replies
Dec 23, 2010
In actionscript3 how do i pass an parameter with an event call. when i use dispatch.
like dispatchEvent(new Event("Loaded", myvariable));
View 4 Replies
Mar 3, 2011
I´d like to know how could use the Timer class extended.I´m trying to pass a parameter to the constructor function, so I can use it inside the listener.
Here´s example:
[CODE]
package { import flash.utils.Timer import flash.display.DisplayObject public class ChangeColorTimer extends Timer { public static const CHANGE_COLOR:String = "changeColor"; public var obj:DisplayObject public function ChangeColorTimer(delay:Number, repeatCount:int, obj:DisplayObject ) { super(delay, repeatCount) this.obj = obj } } }
[/CODE]
That was the ChangeColorTimer that extends Timer.Now, I´d want to know how would I use ChangeColorTimer.I thought it was the same as using Timer.I´ve tried this:
[CODE]
public function changeColor(mc:MovieClip):void { var colorTransform:ColorTransform = new ColorTransform() colorTransform.color = 0xEE0000 mc.transform.colorTransform = colorTransform var changeColorTimer:ChangeColorTimer = new ChangeColorTimer(400, 1, mc) changeColorTimer.addEventListener(ChangeColorTimer.CHANGE_COLOR, setNormalColorListener) changeColorTimer.start() } private function setNormalColorListener(e:Event):void{ trace("called") }
[/CODE]
I called changeColor, but, I don´t get "called" in the output from the setNormalColorListener listener.
View 2 Replies
Mar 29, 2011
i want to pass by reference so i can use this variable outside the function.
What im doing is creating a global variable such as var cont:int; and then in a eventListener like enter_frame (stage.addEventListener..) calling a function called "mover", this function modifies "cont" value and i just want to print this value modified. The issue is i cant pass the value by reference just by const :S. The function is void, but if i change it to return int, its useless because each time i call the function, the value i want to return its created each time with a new value, beacuse i need to declare it so.. I read i can use a var such as Object but i really dont get it (im used to c++ i have to say)
View 3 Replies
Sep 26, 2011
Is there any way to pass parameters to mc.onRelease?
View 5 Replies
Jan 5, 2012
I am writing a text file with batch file and this batch file which is called from fscommand.
I need to pass a parameter from fscommand. Is is possible ?Following is flash and batch file [code]...
View 3 Replies
Apr 9, 2012
How do I use an unevaluated (and/or possibly undefined) variable as a parameter for a function? For example:
function myFun(a:int):void {
a = 5;
}
[code].....
View 2 Replies
Jan 14, 2010
Inside my function there is an if() statement like this:
if(passedValue < staticValue)
But I need to be able to pass a parameter dictating whether the if expression is like above or is:
if(passedValue > staticValue)
But I cant really pass < or > operator in has a parameter, so I was wondering what is the best way to do this?
Also if the language I am using matters its ActionScript 3.0
View 4 Replies