ActionScript 3.0 :: Using An External Class / Function To Return Variables
Jul 29, 2008
I'm using a class that I converted from AS2 to AS3 using Patrick Mineault's converter: [URL]
The original AS2 class:
Code:
/**
* Colour handling routines
* Culled from many places:
* - http://www.actionscript.org/forums/s...d.php3?t=15155
[Code]....
Is the AS2 to AS3 conversion part of the problem (aside from my ignorance of how to use it)?
View 3 Replies
Similar Posts:
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
Jul 21, 2011
As seen below, I tried to return more then one variable from a function but , I think I have some syntax problem..
function hesapla3(parametre1,parametre2):(Number&&Boolean) // PROBLEM IS HERE, I NEED TWO VARIABLES TO RETURN{var yenideger2:Number=new Number();var bol2:Boolean=new Boolean();yenideger2=parametre1+parametre2;if(yenideger2>80){bol2=false;}return yenideger2;return bol2;trace(yenideger2);trace(bol2);}
View 3 Replies
Aug 14, 2009
I have a class to load some XML and build the data into an array but I can't get the timeline to see the array. [code]...
View 4 Replies
Nov 9, 2011
I'm new to Actionscript programming. I'm trying to figure out what is the best way to return multiple variables, each having a different data type, from a function. For example, if a function needs to return variable aa ( a string) and variable bb (a number).
The function I'm using just crunches a lot of math, and doesn't relate to an object in a GUI. One method I got from a Google search used an Object, but as (I think) this requires me to create a class, I wondered if there was a simpler way. Since an array can hold elements of different data types, perhaps this is a simpler approach (?). [code]...
View 2 Replies
Oct 22, 2011
I am trying to access a function in a loaded swf that has external class.. I would like to avoid having to put the function on my "Main" Doc class in the external swf and instead access the function directly from the class
This is what ive tried so far and it's a no dice:
private function startLoad(){
var loader:Loader = new Loader();
var req:URLRequest = new URLRequest("one.swf");
[Code]....
View 1 Replies
Feb 8, 2006
when I have access to my variables. I have the the follow code:
class Slider {
var myVar = 4;
function Slider () {[code]....
The slider function is being called first to update the myVar value then the findValue function is called. How do I get the find Value function to output 6 ? I want a function that updates the main classes' variable so thet I can use it from any function.
View 1 Replies
Apr 1, 2012
I have created a loader class that retrieves variables from an external text file. I call the loader class and all works well but I cannot figure out how to retrieve and use the variables in the Main class.
[Code]...
View 3 Replies
Jul 13, 2010
How can use stage variables and function from external loaded swf files.& Can Possible without using parent.parent fromat, can possible root.format if possible how .
View 1 Replies
Jul 13, 2010
How can use stage variables and function from external loaded swf files.& Can Possible without using parent.parent fromat, can possible root.format
View 1 Replies
Aug 26, 2009
If i have a series of variables that are referenced on an enter frame function, is it better to declare the frequently used vars at the class level? Is there a performance benefit? What is the standard?
Example
[Code].....
View 2 Replies
Jul 15, 2010
I have small issue in as3. I am load "mainmenu.swf" file into "main.swf". through loader class. so now "main.swf" is parent "mainmenu.swf" file children how can call "main.swf " variable & function from "mainmenu.swf" .
View 2 Replies
Sep 7, 2011
FDT can do it, but half the time it times out and needs to be restarted on renaming some objects. Can Flash Builder do this?
View 1 Replies
Jul 9, 2009
I have a main.swf that loads in an external swf called home.swf. I want to be able to call a function in main.swf's doc class from the loaded swf:
Code:
function loadArtist():void { // my function }
in the main timeline of home.swf I'm calling it this way:
Code:
function timeToGo(m:MouseEvent):void {
trace("button pressed");
MovieClip(this.parent.parent).loadArtist(); }
the home.swf compiles fine but when loaded in the main.swf & the button is pressed i get this error:
TypeError: Error #1006: loadArtist is not a function.
at home_fla::MainTimeline/timeToGo()
It seems that it thinks loadArtist is a property. Ack. I've got 3 objects loaded dynamically using addChildAt(mc, 0) ...
View 2 Replies
Mar 24, 2010
I'm trying to load an external swf into another swf and acces some variables and functions. This actually works quite well, however I'm dealing with some variables from the external loaded swf that are read-only.I'm wondering if I could somehow change the variable to be writeable as well by extending a function from the loaded swf.Maybe there's also another way to change the read-only variable, but I have no clue.I know all the variables, functions and class names from the loaded swf, I just can't change them myself, I have to do it by loading the swf externally.The class from the external swf is called "Application" where I want to change the "public const DEV_SERVER_URL:String" to another string, or extend the function: "private function get serverUrl()" returning a string.[code]
View 1 Replies
Nov 11, 2010
I've got a confusing situation which wont seem to fix itself basically I have my main class, my iContent class (which will hold each page and have functions for all pages), and my individual pages.
The homepage is instantiated by calling the iContentClass.goHome method in the main document class. The home page contains a button to go on to the next page. This button references the goColourBrowserPage function within the iContentClass, which removes the child (being the home page) and attempts to add a child (colourBrowserPage).
For some reason this doesnt work! It doesnt seem to add the child and wont let me remove the child of the home page! I've been sitting here for 3 hours trying to work it but to no avail!
[Code]...
View 1 Replies
Jul 15, 2011
I am creating a side scrolling game in Flash (as3) and trying to keep things organized and clean.Ive created a "Level" class that gets all the level data, player data, and creates all the terrain objects and the player object. Its starting to get messy because im handlng all of the functions for player collision checks and player movement, terrain movement, sound starting and stopping, enemies, and more, all in this class. Is this normal? Or is there a better way to organize things to keep them separate, but still allow them to interact with each other.
View 2 Replies
Aug 1, 2011
i want to call an external function inside a class. thats the code;
in checkConnectionStatus function,
this[_funcNameForSucceededCon].apply(); doesnt work because "this" is the class, not the Application. How can i reach Application at this time or what can i do?
package myLibrary
{
import air.net.URLMonitor;
import flash.events.Event;
[Code]....
View 1 Replies
Feb 9, 2009
I'm quite confused about how to do it, look at this [code]...
View 2 Replies
Jan 30, 2010
For some reason I cant figure this out,I have a function thats in a method in a class..I have a second method in the same class, trying to call the function from the second methodeg:
Code:
package com.sarin
{
[code].....
View 4 Replies
Aug 18, 2009
I found myself loading a new XML file every day and so decided to create a small class that will load the xml file and return it.The class is loading the file but when i try to return it to a new xml object in the document class it doesnt load it.I think that it's something to with the return being in a nested function but i tried a few ways and non seems to work.
[DOCUMENT CLASS]
loadXML:LoadXML = new LoadXML();
myXML:XML = new XML(loadXML.loadXMLFile("gallery.xml"));[code].....
View 1 Replies
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
Mar 25, 2010
I want to create a MovieClip, pass this MovieClip to a function in another class where it will be modified.The problem is, when I pass the MovieClip as a parameter to a function and start making changes, the changes are only made locally. The "copy" of the MovieClip inside the function gets changed, but the "real" MovieClip back in my main game class remains unchanged. Here's the code from my Main class:
Code:
var resourceLoader:ExternalResourceLoader = new ExternalResourceLoader();
var myMovieClip:MovieClip;[code].....
View 4 Replies
Mar 28, 2011
I'm building a drag and drop quiz. each draggable mc (drag#) has a base class of DragDrop. I want to detect when an drag mc has been dropped on a target
Code:
if(this.hitTestObject(target)) {}
And then add a new drag from the drops Array. so that each time a drag finds its target a new one appears. I tried to make a public var named dropped to switch from "yes" to "no" in the drop function. and even tried making the drop function public.
This code is on the timeline
stop();
var drag1:Drag1;
drag1 = new Drag1;
addChild(drag1);
drag1.x = 100;
drag1.y = 100;
[Code] .....
View 8 Replies
Oct 12, 2008
I've got 3 variables called pSize1 = 15, pSize2 = 16, pSize3 = 17. I have some radio buttons that have the data: 1, 2, 3. depending on what radio button is pressed, I need to trace the data in either pSize1, pSize2, or pSize3.if they user presses the first radio button, it returns data 1, how can I combine that with "pSize" to return 15, and not "pSize1". What i have tried so far:
Code:
var listenerObject:Object = new Object();
listenerObject.click = function(eventObj:Object):Void {
thisSize = eventObj.target.selectedRadio.data[code]......
View 2 Replies
Jan 26, 2011
I want to assign an existing Object all the vars of a prototype Object, without a direct reference. One way to do this is:
[Code]...
This way both Object's values for .nom and .age can be independently changed, but it's tedious. Is there an automated way to assign all of protoObject's vars to enObj?
View 9 Replies
Jan 22, 2009
First of all sorry im not very familiar with the flash lingo, im still new to all this actionscript stuff
ok so i wrote this on a frame in the timeline[code]...
now i need to check which one from all these has a value of zero. then when it finds it i need it to tell me which one it is (s1x or s2x or s3x) so i can do stuff with it.
View 4 Replies
Feb 13, 2011
I have the maximum possible reduced cod of an xml accessing data:
Code: Select allvar myLoader:URLLoader;
var myURL:URLRequest;
var myXML:XML;
[code]....
How i could make a CORRECT RETURN of these myLoader.data possible values so i could have "in the end" some EXTERNAL variables:
var myName:String = new String()
myName == .....the result from function "readXML": ....trace(myXML.product.name[2])
or
var myNumber:Number = new Number()
myNumber == .....the result from function "readXML": ....trace(myXML.product.length())
View 3 Replies
May 15, 2004
I am using Freddy Thunder's tutorial on how to make a login script with php/mySQL The problem is that the button doesn't do anything when I click it. I can't tell if it goes to the php script, but it sure doesn't return the correct variables like it is supposed to.
View 3 Replies
May 15, 2004
I am using Freddy Thunder's tutorial on how to make a login script with php/mySQL
The problem is that the button doesn't do anything when I click it. I can't tell if it goes to the php script, but it sure doesn't return the correct variables like it is supposed to.
[URL]
View 3 Replies