ActionScript 2.0 :: Class Linkage To MovieClip And Pass Parameter?
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
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
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
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
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
Nov 7, 2004
Let's say 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
May 10, 2005
How do I reference a library movieclip in a class?I couldn't get it to work entering the name of the class in the linkage properties (as2 class name text field). The variable was undefined.
View 4 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
May 10, 2005
How do I reference a library movieclip in a class? I couldn't get it to work entering the name of the class in the linkage properties (as2 class name text field). The variable was undefined. I know I'm missing something....what is it?
View 4 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
Feb 23, 2011
Assume I know practically nothing about AS3! I'm using Flash Pro CS5. I'm trying to reassociate a flash file I've been given with its external assets and classes. In the library I have a movieclip with linkage to a class called 'StaticMap' using the base class 'flash.display.MovieClip'. am I missing a custom class file called 'StaticMap.as' that was originally located in the same folder as the fla, or is this a generic class accessible to all movieClips from within Flash?
View 7 Replies
Dec 26, 2011
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 Replies
Jun 1, 2009
I have placed a movieClip to the stage and added a linkage class "drag" to it... this class is basically has drag functionality in it the and the drag position is stored in a variable... How can I send the drag position value from my linkage class to the Document class "main"...?
View 1 Replies
Dec 13, 2009
I need to pass a variable value contained within a MovieClip to my class file. The MovieClip is my preloader, to which my code will show that upon the initial launch of the SWF. Until the variable is sent, my code assumes the preloader is still running and therefore will not progress. Originally, it was working when I had my class file extend MovieClip and then used this code in the preloader MC:
[Code]....
View 1 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
Nov 20, 2008
I have a movieClip named MC, and it's enabled with action script, with the class name MC_Rectangle and a Stage.I override the MC_Rectangle class file in a mc_rectangle.as external file.here is the code:
package{
import flash.display.*;
import flash.events.*;[ code].....
I have new a object in the main stage var
mc_rect:MC_Rectangle = new MC_Rectangle()
in main stage:
1. how can i access the variable "sequence" in "mc_rect"
2. how can i pass parametre from main stage to mc_rect via function setSequence(data:int)?
3. how can i call the function in addSequence() in mc_rect.
in asp.net, i usually use mc_rect.sequenct,mc_rect.setSequence(data), mc_rect.addSequence() to achieve my goals......btw, can function in mc_rect return out result to main stage?
View 1 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
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