ActionScript 3.0 :: Return ContentLoaderInfo From Another Class?

Nov 4, 2009

I am writing a method in a FileIO class called returnBMP()

The idea is: I want to pass it a file name, and I want it to return a Bitmap. ( not a loader )

The problem is that the only way I know how to pull a bitmap out of a loader is by creating an eventListener on the contentLoaderInfo for COMPLETE.

That just doesn't work in a return function. the return is executed before the bitmap is loaded. I get a null..

here's my code:

ActionScript Code:
public function returnBMP(img){
var bmp:Bitmap;
var loader = new Loader();

[Code]....

View 4 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 :: Class Is Loading The File But When Return It To A New Xml Object In The Document Class It Doesnt Load It?

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

ActionScript 3.0 :: Class - Cannot Return A Value

Sep 26, 2010

I am trying to write my first real class (it works when I just use trace statements). The main part of the function returns a value and since the constructor can not return a value I was not sure how to handle it, so I did this...

[Code]...

View 6 Replies

ActionScript 3.0 :: Return A Value(xml) From A Class?

Jun 10, 2009

How would I return a value from this class?

package com.ryancanulla.utils
{
import mx.collections.ArrayCollection;

[code]......

View 8 Replies

ActionScript 2.0 :: Get Return From Class

May 7, 2008

I created a class that returns and array. How can I access that return from my main timeline?

I just need to trace the return in this case.

GetTeams.as

Code:
class GetTeams {
public function GetTeams () {
var teamLoaderURL:String = "teams.jsp";

[Code]....

View 8 Replies

ActionScript 3.0 :: Make A Class Return Value?

Sep 22, 2011

Possible to create something like the following[code]...

View 9 Replies

ActionScript 3.0 :: Get A String Return By A Class?

Oct 8, 2009

I have a question about return..example:

Code: var date: Date = new Date(); trace (date)//Thu Oct 8 23:05:51 GMT-0300 2009 How i can get a String return by a Class? The default return with a normal Class is ([object Date])... Constructor can`t return values... how i can make that? :p

View 3 Replies

ActionScript 3.0 :: Return A Value From An Extended Sprite Class?

Jul 14, 2009

I created a menu from a created .as extended Sprite class.

Except from this menu, I need it to return a String value of the item name the user selected.

View 17 Replies

ActionScript :: Custom Class With Return Type?

May 24, 2010

i want to essentially classify a simple function in it's own .as file. the function compares integers. but i don't know how to call the class and receive a boolean return.

here's my class

package
{
public class CompareInts
{

[Code]....

so now i'd like to write something like this:

if (CompareInts(1, 5) == true). or output 'true' by writing trace(CompareInts(1, 5));

View 3 Replies

Actionscript 3 :: Return Loader Object As Class?

May 16, 2011

I have to implement a menu with icons using actionscript only. I create a data provider from XML and set

menu = Menu.createMenu(null, dataArray, true);
menu.iconFunction = iconFunction;

Till here everything is fine and my menu is presented, but only with labels.
I create iconFunction as following:

private function iconFunction(item:Object):Class
{
var st:Loader = new Loader();
st.load(new URLRequest(item.icon));
return ?;
}

how do I return my loader object as Class?

View 2 Replies

ActionScript 3.0 :: Return Class Instance As String

Feb 1, 2009

Is there anyway to include a function or overrite something in a class that'll output a custom string when the object is called as a string?

So for example if I created a class named "myClass" and I instantiated it:

Code:
var myObject : myClass = new myClass();

When I:

Code:
TextControl.text = "blah blah, " + myObject;
myObject is getting casted as a string. Normally it would output:
"blah blah, [object myClass]"

Is there a built-in function that recast the object as string? Is there anyway for me to change that string output? I know I can just make a public toString() method in the class or something, but just wondering if there was something better.

View 3 Replies

ActionScript 3.0 :: Main Class Return Nulls?

Jun 22, 2010

This is class for xml:

ActionScript Code:
internal class RandomItem {
private var randomNum:int;
private var instantName:String;
private var itemsXML:XML;

[Code]...

View 3 Replies

ActionScript 3.0 :: Call A Class That Can Return A Value In Number?

Mar 5, 2011

I know how to pass a value to a class that need to be called, but how to call a class that returns a value?

can someone show me how to call it and how to write the class that returns a number?

View 4 Replies

Actionscript 3 :: Listen For Event Then Return Result From Class?

Jan 11, 2012

I have an as3 class that I use for communicating with my Zend_AMF endpoint:

[Code]...

All of this works fine, but it takes a lot of work to use it. I always expect a Response object when calling send() on my request. Ideally I would like to be able to call request.send() and have it return a Response object directly and not having to deal with a listener: var result:Response = request.send(); Is this possible? If so, how can I go about doing this?

View 1 Replies

ActionScript 2.0 :: Make A Custom Class Return An Array?

Feb 22, 2009

I'm making a custom class and all my get functions are working fine except the one that returns an array. Here is the code for my class (abridged to the relevant parts):

ActionScript Code:
/*
VolcanicIsland class for Polypelago
Script in progress

[Code].....

How do I get an array to return correctly? Doing trace(VI1.getData()[0]) doesn't work either.

View 1 Replies

ActionScript 3.0 :: Return Image Array From Loader In Another Class

Nov 6, 2010

I want to load an array with images in Main.as, by using a loader in another class. The problem is, I have to wait for the images to load before returning the array. How do I return the array images[] (once it's loaded) back to characterGFX[] in Main.as? I'm just lost.

Main.as

Code:
package {
public class Main extends Sprite{
private var gfx:Gfx = new Gfx();

[code]....

View 9 Replies

ActionScript 2.0 :: Setup A Class Which Will Load Xml And Return Data?

Feb 19, 2007

Im trying to set up a class which will load xml and return data I can later parse with a parser class.

When I run the getRawData function from the fla, I get [type function].

[code]...

View 2 Replies

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

ActionScript 3.0 :: Return Vector Object From Composing Class

Mar 16, 2011

I have a CSV reader class that parses a CSV file.....
1,11.15126526
2,11.28306635
3,10.78296071
4,10.79878325
The CSV reader class works and produces a Vector.<Point> ... However the container class (which includes an instance of the CSVFile class) needs to access the resultant Vector. Whenever I 'return' the Vector.<Point> to the container via a CSV method it is always empty...I don't know if its something to do with the size of the Vector<> or what?

View 5 Replies

ActionScript 3.0 :: LoaderInfo Of ContentLoaderInfo?

Jul 7, 2011

As a part of a class I have been asked to place a preloader in front of my projects. I can't believe how tough this is. I get the best results when I use an URLRequest, but I want to understand the timeline.When I put a working preloader in front of my movie it doesn't start "ticking" until some middle point like 20%, or 70% depending on the file size of the movie. When I trace the bytes.Loaded it doesn't start counting until 700K or so.I have looked at several different preloaders and none seem to work as well as the tutorial. Can someone direct me to an "easy to understand" source that explains the loaderInfo / contentLoaderInfo class?

View 3 Replies

Flex :: Static Constants Return Instance Of Specific Class?

Apr 29, 2010

I have a class ErrorMessages which holds all my error messages as static constants. So I could access them like ErrorMessages.PASSWORD_INVALID or ErrorMessage.PASSWORD_TOO_SHORT. I want to know if it is possible to have separate classes that hold subset of these constants and access them like ErrorMessages.PASSWORD.INVALID or ErrorMessages.PASSWORD.TOO_SHORT, etc. This way I can more structured static structure and makes it much easier to use autocomplete. I tried few different ways and couldn't figure out if this was possible..

View 3 Replies

ActionScript 3.0 :: Return Data From Custom Class On Complete Loading?

Feb 11, 2010

How do you return data from a custom class, and only when something in the custom class has completed something. For example, let's say I have this code in the custom class[code]...

This, of course, doesn't work. I need the whatever.getLoadedObject() method to wait until the loading has finished inside the custom class then do whatever with the image loaded.

View 2 Replies

ActionScript 3.0 :: Can't Get ContentLoaderInfo Progress Info

Jan 19, 2010

Here's the code in question:

[Code]...

When I preview the file I get the following errors: Quote: 1119: Access of possibly undefined property bytesLoaded through a reference with static type flash.display:Loader. 1119: Access of possibly undefined property bytesTotal through a reference with static type flash.display:Loader. If I comment out the onProgress function and it's associated event listener the file runs fine. I believe both event listeners call the flash.events

View 3 Replies

ActionScript 3.0 :: Accessing The Object Of ContentLoaderInfo

Oct 20, 2007

How do I access the object of an event? Can't quite figure it out. This is what's happening.

object.contentLoaderInfo(Event.INIT, someFunction);
private function someFunction(e:Event):void{
trace(e.target);
}
Output = [object LoaderInfo]

I want to access the parent of the object, but I'm hitting a dead end.

View 3 Replies

ActionScript 3.0 :: Getting The Loader Object Via ContentLoaderInfo?

Mar 6, 2009

I am loading images dynamically from the web into my swf. I use a loader class and add an Event Listener to the loader so it will add the image to the stage when done.

Code:
for (var i:int = 0; i < number; i++){
var poodleLoader = new Loader();
poodleLoader.load(new URLRequest(urls[i]));
poodleLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, showPoodle);
}

But what I do not manage to do is referring from the Event.COMPLETE-event to the loader object in my showPoodle-function. How do I refer to it? I was thinking addChild(e.target.parent.data) but it tells me the contentLoaderInfo has no parent?

View 2 Replies

ActionScript 3.0 :: Return ResultEvent Properties Of HTTPServices Inside Class Methods

Sep 29, 2010

I currently have my own class, for arguments sake, lets say it's called User and is for logging into my own system.

I would like to call a function from the user class called, say, login(), which would send the username and password attributes to a service (in my case, PHP), and then get the data back with the response (either successful or unsuccessful).

This would ideally make my code behave like this:

Code:
var user1:User = new User("Jim", "password");
var loggedIn:Boolean = user1.login();

[Code]....

I don't know of a way of getting the login function to return a boolean based on the result of the HTTPservice it sends, so does anyone know of a better way of doing this?

View 0 Replies

ActionScript 3.0 :: ContentLoaderInfo Doesn't Seem To Work From Host

Jul 4, 2009

I have a preloader function that uses contentLoaderInfo to load swfs ont the stage. It works fine in simulated download in the Flash Player. When I run it on my host the swf file finishes downloading before the preloader appears to run. I use the word appears because I only sometimes spot a glimpse of a graphic that indicates the loading process.
 
Are there known discerpancies between host and Flash Player realities?
 
Are there any subtlties with using with contentLoaderInfo?

View 8 Replies

Flash :: Get Loader Name Property Through ContentLoaderInfo Handler?

Apr 12, 2011

I wanna pass a value through an image loading event, and my simple aproach was setting a name into Loader object. But I'm not had success in that.

function loadAll()
{
for(var i:uint = 0; i < len; i++)

[code].....

View 2 Replies

Actionscript 3.0 :: Looping With ContentLoaderInfo Complete Information?

Oct 5, 2010

I basically have rectangles which I want to replace with images I load through XML references. The rectangle instance names are from image0-imageNumberWhatever. I've got everything working, the only thing I can't seem to do is once each image is loaded, it fades in instead of randomly appearing. Below is my code:

Code: Select allimport flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;

[code].....

View 2 Replies







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