ActionScript 3.0 :: Return An Object With A Function?

Jun 18, 2009

I'm trying to create a function that determines which of 4 similar classes to create, and returns the new object itself.

Basically, I have a base class (Panel) that has 3 additional variations in layout, each of which has a subclass: TextPanel, FeaturePanel, and LinkPanel. The two parameters for my function are the "kind" of window to create and its name ("linkString"), both of which are provided by external XML. I'm wondering if it's even possible to return the new Panel as an object...?

My code will probably explain this better than I can:

Code:
// create the new Panel variable ("addPanel") with a call to newPanel:
var addPanel = newPanel(linkList[i].attribute("kind"), linkString);
Code:
// newPanel function:

[Code].....

within the Panel constructor, the provided string (linkString / 'h') is set as the Panel's .name. I did not copy that function into the subclasses, since they inherit it - unless I'm mistaken.

View 8 Replies


Similar Posts:


ActionScript 3.0 :: Inheritance / Interface - Override A Function That Return An Object Of Class A And Make It Return An Object Of Class B Which Extends A?

Aug 4, 2009

I'm having some troubles with the use of interface and inheritance in AS3. I've done lots of OOP in the past and what I'm trying to do seems obvious to me, but doesn't work in AS3. The question is : Is it possible to override a function that return an Object of class A, and make it return an Object of Class B which extends A ? It seems not to be possible, since I'm getting a signature error in Flash, when compiling. For example, the following set of class do not compile (the code in function definition doesn't matter):

[Code].....

View 3 Replies

ActionScript 3.0 :: Function Return More Than One Item Or Object?

Aug 16, 2011

I am trying to move text movies and textfields around a stage. This is a learning curve for me. I am confused by an example I have found on the internet.

[Code]...

View 6 Replies

ActionScript 2.0 :: Send A String To A Function And Return A Object?

Mar 16, 2010

is it possible to send a string to a function and return a object??? here is the code, but it doesn't work

[Code]....

View 2 Replies

Actionscript 3 :: Return An Object With An Update Data, That Is Pass In To A Public Static Function?

Dec 23, 2011

How can I return an object with an update data, that is pass in to a public static function?

GetDate.dayName(MyDate.setDate(1984,3))
//MyDate with new info (year, month) will be pass into GetDate.dayName
package hwang.time

[code].....

View 3 Replies

ActionScript 3.0 :: Return Result From Function Called By Function?

Aug 4, 2010

I'm using an AMF service that was built by someone else. Basically what happens is that some info is passed to the AMF service and it returns true or false.I want to be able to pass in various info to the a function that calls the AMF service(submitTracking) and then get the true or false value returned in onResultSubmit to be passed back to submitTracking.

var screen:String;
var buttonnumber:String;
function submitTracking(screen:String, buttonnumber:String) {

[code]....

View 3 Replies

ActionScript 2.0 :: Return The Target Of A Tween Object From Within The Object?

Nov 7, 2006

Is there a way to return the target of a Tween object from within the object?

Code:
myTween.onMotionFinished = function (){
trace (this.target)
}

That's obviously not the way you do it, but that's what I want it to be...

View 9 Replies

ActionScript 3.0 :: Return The Name Of The Object That Is Under The Entire Bounding Box Of The Object

Feb 11, 2009

It seems that dropTarget only returns the name of the object that is directly under the mouse. Does anyone know whether there is a simple way for it return the name of the object that is under the entire bounding box of the object being dragged?

View 1 Replies

ActionScript 2.0 :: CS3 Return A Value From A Function?

Mar 29, 2010

Anyway, I have a function that goes through an XML file, looking for a specific value. If it finds it, it should return the node that contains that value. However, I'm having trouble with the whole return part of it.My code is:

Code:
thisExpando.onRelease = function() {
trace("is this me? " + this._name);

[code].....

View 2 Replies

AS3 :: Flash - Return A Value From A Function?

Aug 21, 2010

I am trying to have the function toggleClick return powerData. I need to store powerData in a variable and have it passed to another function to do calculations.

Inside the function toggleClick, I am assigning powerData to houseArray[e.currentTarget.name.toLowerCase()];

var powerData:int = houseArray[e.currentTarget.name.toLowerCase()];

I tried just to write return powerData--but it breaks the program.

// function toggleClick
function toggleClick(e:MouseEvent) {
// Store "Power" Values of House Objects in Array

[code].....

View 1 Replies

ActionScript 3.0 :: Function Can Not Return A Value

Nov 19, 2009

I'm communicating to these movie clips with another program via binary sockets.For the first set of movie clips: when it recieves its instance name, and a second number (InstanceName+#) from the socket, the named movie clip will jump to the frame corresponding with that number. for ex:if the incoming data from the socket is (mc7+3), then movieclip 7 will jump to frame 3.

For the second set of movie clips: when it recieves its instance name, and a second number (InstanceName+#) from the socket, the named movie clip will move location across the screen, by the y coordinate moving to the # given by the socket...thats a little confusing. for ex: if the incoming data from the socket is (mc4+500), then movieclip 4 will move so that it's y coordinate is at 500.[code]...

View 2 Replies

ActionScript 3.0 :: Function Can't Return A Value

Jul 21, 2010

After reading about classes, package, namespace and classpath till not able to understand what is the best way to write classes....

Here I am facing problem with this error can you tell me what mistake I am doing here.[code]...

View 7 Replies

IDE :: Return From TIMER_COMPLETE Function?

Jan 29, 2009

How can I return a value from within a timer function? This doesn't work:

if (timeOneSec()) {
doSomething ();
}

[Code]...

View 1 Replies

ActionScript 3.0 :: Return To A Calling Function?

Dec 15, 2008

I have several buttons calling the bounceOut() function andthe bounceOut() function calls the onMotionFinish() function. Afterthat function is finished I want to go back to the original callingFirst a call is made to bounceOut() when a button is clicked.I have ten buttons.

function bounceOut() {
var smSlide:Tween=new
Tween(sideMenu_mc,"x",Regular.easeOut,200,-200,2,true);

[code].....

View 2 Replies

ActionScript 3.0 :: Return A Value From A Function To Public?

Sep 26, 2008

there is an interesting problem here:

How to return a value from a function to public?

Here is the code:
var df:String; //i declared it here
function onResult(e :OperationEvent):void
{
df = e.data.toString(); // i set it here

[Code]...

View 5 Replies

Actionscript :: Create A Function That Can Return?

Jan 24, 2011

How do make a function return *, by star, I mean the function is able to return anything, and then I can typecast it accordingly?

[Code]...

View 3 Replies

Actionscript 3 :: Return MovieClip From Function

Jun 3, 2011

I basically have a class which loads a set of MovieClip objects and provides accessor functions to return them.[code]Obviously this doesn't work, but it gives an idea of what I'm trying to do. I want to return a MovieClip to the calling code only if the object has been loaded.

View 2 Replies

Flash :: Return From Inside Function?

Jul 21, 2011

I have one function "Login" and function "_urlSended" inside of function "Login". So i want that sub function returned value as a parent function. I just want that script to work

<![CDATA[
function onButton1click():void {
Label1.text = Login('irakli', 'password1');

[Code].....

View 2 Replies

Actionscript 3 :: Get The Return Type Of A Function?

Oct 25, 2011

It doesn't appear to be possible to get the return type of a function. Is this correct?

View 1 Replies

ActionScript 2.0 :: Slideshow - Return Value From Function Should Be 20 But Instead I Get 0 ?

Jan 3, 2009

I've run into a bit of a snag on this slideshow I'm trying to create. My plan involves adding movie clips from the library by attaching them to an empty movieClip. Then using setInterval and a variable as a counter, it increments in the function. When the number reaches "20" the first movieclip is removed and the next one is displayed. Here is my code:

ActionScript Code:
createEmptyMovieClip("canvas_mc", 1);
canvas_mc._x = 75;[code]....

//How do you bring on the second slide when the first is removed? So, my problem is that I'm thinking that the return value from my function should be 20 but instead I get 0 in the trace statement.My plan was if it equaled 20 to bring the next slide out from the library, thus moving forward with the slideshow.

View 9 Replies

ActionScript 2.0 :: Return Value From Function That Does SendAndLoad?

Feb 4, 2009

In the code below - fRequest_activate initiates a sendAndLoad - all fine and dandy. Thing is - I want to be able to return a value from this function that indicates whether the server response was satisfactory - and I can't work out how to to it.Because the onLoad function is nested within my fRequest_activate function it has all got a bit messy - and just doesn't work - how do I pass the status from an asynchronous server call - which at the moment is picked up by the onLoad callback, back to my original function? - or should I just approach this problem in a different way? All I want to do is call one function - and know if it has been successful or not in talking to my server.

Code:
function fRequest_activate():String {
var lvEmail_send:LoadVars = new LoadVars();
var lvEmail_response:LoadVars = new LoadVars();[code]...............

View 5 Replies

ActionScript 3.0 :: Return A Value From A Load Function?

Sep 17, 2009

I'm trying to define a variable as a function that loads a text file, like this:

ActionScript Code:nouns = loadFile( "nouns.txt" );

The problem is I can't see how to get "loadFile" function to return the value because I have to use that event listener function to tell when the load is complete, then I can't return from inside the listener function... how can this work?

[Code]...

View 2 Replies

ActionScript 2.0 :: Assign The Return Value Of A Function?

Oct 19, 2005

I was just curious if you HAVE to assign the return value of a function to something in order to preform operations on it.

Code:
something.getClip().onRelease = function() {
//
}

Thats probably illegal right? It's illegal in C++, but theres usually a way to get around it like.. (getFocusClip()).onRelease. Or should I just forget it and do it the right way:

Code:
var tempClip:MovieClip = something.getClip();
tempClip.onRelease = function() {
//
}

View 4 Replies

ActionScript 2.0 :: Return Not Working In A Function?

Mar 21, 2007

Ok, I have a function that creates a button, it takes the paramaters

bX, bY, bcColor, bbColor, bHeight, bWidth, bHandle;

here is my function

Code:
function createButton(bX:Number, bY:Number, bcColor:Number, bbColor:Number, bHeight:Number, bWidth:Number, bHandle:MovieClip)
{

[Code]....

some reason when I try to hide Handle, it doesn't do it, & trace's dont do anything either it is suppost to create the button & store it in any handle I give it

View 3 Replies

ActionScript 2.0 :: Datatype Should A Function Return?

Apr 17, 2007

The title of this post may not make much sense, let me explain. I have a function:

findSurface(origin:Point, vector:Point, attempts:Number):Point The function has an obscure use, but the idea is thus: given those three arguments, returns a point IF the 'line' (created by the origin and vector arguments) intersects the object the function is called on. [but that is another story...]

More importantly, if there is no point of intersection at all, what should the function return? Void? Null? Undefined? Object? Or can I use one of those return types instead of Point incase the function does not encounter an intersection?

View 6 Replies

ActionScript 3.0 :: Return URLVariables From A Function?

Apr 17, 2009

Is there a way to return URLVariables from a function

eg:

function varsLoaded():URLVariables {
var variables:URLVariables = new URLVariables();
variables.var1 = 'string1';

[Code]....

Now what I would like to do is assign "variables" to a variable:

var theVar = varsLoaded();
trace(theVar.var1);

Obviously the code above isn't correct; just to illustrate what I'm hoping to accomplish.

View 1 Replies

ActionScript 3.0 :: Return A Value Out Of A ROLL_OVER Function?

May 18, 2009

I cannot for the life of me figure out how to return a value out of a ROLL_OVER function. It seems extremely easy, yet I cannot get it to work. Here is a simplified version of what I am trying to do:

test_mc.addEventListener(MouseEvent.ROLL_OVER, testOver);
function testOver(event:MouseEvent):String
{
return "hello";
}
trace(testOver());

View 3 Replies

ActionScript 3.0 :: Flash Return XML From Function

Jul 20, 2010

I feel like this should be correct but the trace always returns 'undefined'

PHP Code:

function loadXML(xmlFile:String):XML{     var xmlLoader:URLLoader = new URLLoader();    var xmlData = new XML(xmlLoader.load(new URLRequest(xmlFile)));    return xmlData;}var xmlData:XML = loadXML("xml/nav.xml"); trace(xmlData.link.image.text() [0]); 

[Code].....

View 5 Replies

ActionScript 3.0 :: Return XML To Main Function?

Dec 14, 2011

i have my main function:

function main(){
call_xml("myxml.xml");
trace(data)// NULL

[code].....

so, i want to get my data XML var back to main, i get NULL (i think is oncomplete fault )

View 12 Replies

ActionScript 3.0 :: How To Return Sprite Object

Dec 11, 2011

I want to load two picture and add every picture to every sprite object,such as picture a to sprite1 and picture b to spriteb,I know I can load a pictue by following code:

loadImage('a');loadImage('b');private function loadImage(imagePath:String):void {  var loader:Loader = new Loader();  loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded); loader.load(new URLRequest(imagePath));}private function

[code].....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved