ActionScript 3.0 :: Pass A Bitmap Between Two Custom Classes?

Mar 22, 2010

I have two custom as3 classes, TriviaGame and TriviaQuestion, and I am  attempting to retrieve a bitmap image stored in TriviaQuestion and have  found it impossible thus far.

It seems the root of my problem is that bitmap is somehow null in my GetImage() function, even though it is class data that has been set earlier in  ImageLoaded(). The only time I am able to access the bitmap's info (in order to add it  to the display) is inside ImageLoaded().
 
In TriviaQuestion.as, loading the image:
private function XMLLoadedHandler (e:Event):void
{
xml = new XML(e.target.data);

[Code].....

View 14 Replies


Similar Posts:


ActionScript 3.0 :: Use The BitmapData Property Of A Bitmap And Pass It To The Constructor Of A New Bitmap Object?

Aug 20, 2009

I know the topic of "duplicating" movieclips is a hot issue with the new virtual machine. Luckily, I understand the implications. I only am [currently] interested in duplicating a Bitmap. See, I load an image from an URL using 'flash.display.Loader.load', which is a non-blocking operation in Flash Player.However,I may use multiple copies of the loaded image (which is reported to be a Bitmap, naturally) in the display list at the same time.Hence, I naturally do not want to load the image from an URL every time, because I don't want to wait for a non-blocking call to complete. Nor do I need to - I mean one copy is already loaded, so it should be possible to just "duplicate" it, right?

My idea is to do use the bitmapData property of a Bitmap and pass it to the constructor of a new Bitmap object. I have not tried the following in action, but I want to hear whether any of you did and if the following would not work, what would:

Code:

var original_bitmap: Bitmap;
var copy_of_original_bitmap: Bitmap = new Bitmap(original_bitmap.bitmapData);

LiveDocs mention that the BitmapData being passed to a Bitmap constructor is "being referenced", which to me might suggest it cannot be used twice? There is also the BitmapData::clone() method, which I am not sure is applicable here or not.I know this is a lot of talk instead of just trying this out, but I test so much Flash Player code daily just to see "what works" (which should be documented instead by Adobe),

View 4 Replies

ActionScript 3.0 :: Custom Base Classes And Custom Classes

Jun 25, 2009

I've created a base class to house some basic functions I'd like to have across several movie clips in a game I'm making, however, when I link a custom class to the same movie clip I get the message; "The base class will not be used because the class specified is already defined and extends its own subclass. If you wish to use the base class, specify a class name in the Class field that will be auto-generated or enter the default base class 'flash.display.MovieClip' in the Base Class field." I removed the 'extends MovieClip' inside the Class but it still shows the message. Does this mean that I cannot use a custom class and a custom base class on a movie clip?

View 2 Replies

ActionScript 3.0 :: Create Custom Event Class If I Dont Need To Pass Custom Property With That Event?

Dec 28, 2009

Is there a point of creating custom event class if i dont need to pass custom property with that event?

View 3 Replies

ActionScript 3.0 :: Save Drawing Without Bitmap Classes?

Jul 2, 2009

i m making a drawing application .i want to save my drawing wit out bitmap classs because when i reload that it is not editable. So can any one tell me how to save my drawing to server with out bitmap .because i want to reuse it in flash.

View 1 Replies

ActionScript 3.0 :: Pass Variables To Classes?

Jan 14, 2011

I want to send the contents of a variable to a class where it can be used in its functions. Since I have no experience with object orientated programming what so ever I tried to break it down into real simple code so I can understand  better what's going on and how I can implement it in my main code.I made a test file and a test class, basicly I just want to give a variable contents in my main code, then send the variable to the class so the class can trace it. But no matter how I try it i always get "Testoop.as, Line 6 1120: Access of undefined property test.Here is the code:

so this is the FLA:
import Testoop;
var test:String;

[code]....

View 2 Replies

AS3 :: Flash - Pass A Variable Between Classes?

Mar 2, 2011

I've been having a problem with passing variables between classes.

I have one class called GlobeView.as

Within that is a function designed to add markers to a globe

GlobeView.as -
public function addAdventureMarker( latitude:Number, longitude:Number, name:String=null ):void
{

[Code]....

View 3 Replies

Pass Parsed XML Data On To Classes?

Nov 30, 2011

I've traditionally all my as3 code in one included .as file, not as packages / class files, but I'm trying to make that transition. I'm a little confused about how to pass information back and forth among class files though. For example, what I'm trying to make is a sort of node diagram where clicking on a certain node will sprout out its child nodes, and clicking on a child node will sprout out its children, etc. I have a main class, Main.as, which I was going to make parse an XML document and store an array of all the relevant data for each node (things like a title, link, etc). Then I have a class file called Node.as which actually builds the node, adds it to the stage, and sets up its listeners and the motion tweens.

My question is - if all the information for the nodes is stored in Main.as, but the click handling is done in Node.as, how does Node.as know what attributes to assign to each added node (i.e., how does it access the array from Main.as to assign properties to the clips created)?[code]...

View 1 Replies

ActionScript 3.0 :: Pass Variable Through Classes?

Dec 9, 2009

How do you pass variables through classes?

View 7 Replies

ActionScript 3.0 :: Pass Variables Between Classes?

Aug 31, 2011

How to pass a variable from one AS class to another please?

View 4 Replies

ActionScript 2.0 :: How To Pass Variables Into Classes

Mar 18, 2007

ive written a class to control my content panels on my site. They work well! Currently they controll all the positioning perfectly on there own. What I am having trouble with, is how do i pass variables into my classes. For instance, my main content panel, has variables in the class: public var contentState:Number; Now, what I would like to do, is have movieClips on my stage, or 'buttons' that will be able to change 'contentState' within my class.How do i go about passing these variables?[code]

View 1 Replies

ActionScript 3.0 :: Pass The Variable From Timeline To Classes?

Jul 25, 2011

I need to pass a boolean variable initially set to false to one of my classes called "EasyGame".It is than changed to true when one of the function in this class is runned.

View 1 Replies

ActionScript 3.0 :: Pass Variable From URLLoader() Between Classes

Aug 18, 2011

I have two classes. See below.

What I want to do is pretty simple but I must not know how to do it. I want the URLFactory to create the Array and store it in the variable "dataArray" and use the Array in the Main class by calling the GetList() of the URLFactory class. What I have returns nothing...

Basically I need to set a variable equal to  URLLoader.data (var something:String = URLLoader.data) so I can use this variable in other classes.

[Code].....

View 3 Replies

ActionScript 2.0 :: Pass Parameters When You Construct Classes?

Dec 25, 2010

I declare this class which has a value x (In it's own document)[code]...

View 3 Replies

ActionScript 3.0 :: Interface Elements - Pass Events Between Classes

Apr 5, 2010

There are many tutes on the web on how to make interface elements, such as drop down menus, or accordion menus. The example Menu Class includes all the event listeners and functions. It invariably ends with the CLICK event function tracing some comment so you know it works. But no information on how to implement the Menu Class. So say you have a Main Document Class that instantiates a Menu Class. How can you pass the CLICK event back to the Main Document Class to do something with it? As far as I can see, the Menu Class can build the menu but all the listeners and functions for it have to reside in the Main Document Class. Or do you have to build a custom Class that extends the Event Class?

View 3 Replies

IDE :: How To Add Custom Classes

Apr 8, 2010

I use multiple custom classes like tweenlite, csvparse, papervision and many more. The way I do is put them in one central location and edit Flash CS4 Actionscript 3.0 settings to include that location.The problem I face is even though I don't use all the classes in a project, flash CS4 compiles every single class that is in that central location eventually increasing my compile time by minutes.

View 5 Replies

IDE :: Get A List Of Custom Classes?

Aug 26, 2009

Is there any way to get a list of custom classes? I'd like to be able to dynamically access the custom classes (that I've created by the "Export for Actionscript" checkbox in the "Linkage" dialog) without having to hard-code their names into the script.

View 2 Replies

ActionScript 3.0 :: Library Bitmaps - Pass String To The Class Which Expects A Bitmap As A Parameter?

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

AS3 :: Flash - Copy Custom Shape Out Of Bitmap

Dec 3, 2009

I have bitmapA which is rectangular. I have a crop area I want to copy...

However, the bitmap is at an angle from the crop.

How do I copy a section from a bitmap that isn't a rectangle laid outon the x, y, axis??

Or copy custom shape?

View 2 Replies

ActionScript 3.0 :: Bitmap Hue Shift With Custom Palette?

Feb 28, 2009

How do you shift the colors of a bitmap image, with a red/yellow cloud, so that red becomes orange, then yellow, then orange, then red again? The yellow should go trough the same process, but start and end with yellow. Same with all the other colors in between.Kind of like when you play with the hue-setting in photoshop, but instead of looping trough the whole spectrum, it only loops trough red>orange>yellow>orange>red.

View 7 Replies

ActionScript 3.0 :: For Each Loop And Custom Classes

Jun 5, 2009

[code]This is my document class, with the Textfields beeing placed on stage.While this all compiles and displays fine I do not get the trace output for the text fields, actually the only trace I get is "constructing". I tried it without the "each" keyword but to no avail as well.

View 3 Replies

ActionScript 3.0 :: Custom Template Classes?

Jul 26, 2009

I'm looking to extend Vector.<T>, but it's final, so I'm going to have to include it as a member instead.Regardless, I'd like to make the wrapper class type independant, so I was wondering what the snytax for template classes are.

View 6 Replies

ActionScript 3.0 :: Iterate Through Custom Classes?

Dec 26, 2009

Lets suppose, I have a class with so many public properties

class person{
public var address:String;
public var name:String;
public var fathername:String;
//etc etc
}
 
Now i want to iterate over them in a simple way like
 
for (var key:string in person){
trace("property is " + key + " and value is " + person[key]);
}
 
But AS3 doesnt allow this to do with Classes
 
what would be the better and simple way to iterate over them as i dont want to do so many if(else) on it.

View 8 Replies

Actionscript 3 :: Getting Data From Custom Classes?

Oct 27, 2010

How can I get some var / data from a custom classes?The XML class

package classes
{
import flash.net.URLLoader;

[code].....

View 3 Replies

ActionScript 3.0 :: Custom Classes Talking To Each Other?

Aug 28, 2009

i'm still in the process of grasping my move from AS2 to AS3 (or from timeline coding to external classes), and here's a problem i've run into.i have two classes, for the sake of easiness, call them Class1 and Class2.in frame 1, if i have

ActionScript Code:
var c1:Class1 = new Class1();
var c2:Class2 = new Class2();

[code]....

View 4 Replies

ActionScript 3.0 :: Communicating With Other Custom Classes?

Sep 10, 2009

How do I let a custom classes know, what I've done at other classes,so that it would run an action accordingly?a function in the button classes:

ActionScript Code:
public function btnClick(event:MouseEvent):void {
var zoomF:theZoom = new theZoom();

[code].....

View 2 Replies

ActionScript 3.0 :: Extending To Custom Classes?

Dec 14, 2010

Say I have a document class called index, where I set up some variables and methods and include a class.

I get this error:

Error: Error #2136: The SWF file file: index.swf contains invalid data.
at com::index/initIndex()
at com::index()

[Code]...

View 2 Replies

ActionScript 2.0 :: [FMX] Buttons And Custom Classes

Sep 29, 2005

I'm trying to get a button to change color via a Custom class written in ActionScript. I have built and attached an example to show you all what I'm trying to achieve. The code works perfectly with a MovieClip, but when I try to apply it to a Button, it falls flat (can't even find the reference to the button it seems). On my stage are two objects:

1. A Movie Clip
2. A Button

These are both set to "Export for ActionScript", and have an attached class called 'ColorClass'. ColorClass is basically what does all the work (makes a Color object, and has set and get methods). I also have an action layer where all my other code is contained. I'm fairly new to ActionScript, but come from a Java background

View 1 Replies

ActionScript 2.0 :: Extending Custom Classes In AS3?

Oct 30, 2006

im trying to port my code to as3 but i stumbled on a problem i have no idea how to fix.
error report:

Code:
verify PointAirFri$iinit()
stack:
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
0:getlocal0
stack: PointAirFri
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
1:pushundefined
stack: PointAirFri void?
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
2:setslot 14
stack:
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
4:abs_jump 78424138 45
stack:
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
0:getlocal0
stack: PointAirFri
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
1:pushscope
stack:
scope: [global Object$ Point$ PointAirFri$] PointAirFri
locals: PointAirFri Number Number Number
2:getlocal0
stack: PointAirFri
scope: [global Object$ Point$ PointAirFri$] PointAirFri
locals: PointAirFri Number Number Number
3:constructsuper 0
VerifyError: Error #1063: Argument count mismatch on Point$iinit(). Expected 3, got 0.
at PointAirFri$iinit()
at docClass/::init()
at docClass$iinit()
this is how the defined the classes:


Code:
package{
public class Point
{
vars
public function verlet(a)
{
code
}
public function savePoint()
{;
code
}
public function restore()
{
code
}
public function Point(__x:Number, __y:Number, __fr:Number)
{
x = __x;
y = __y;
dx = 0;
dy = 0;
vx = 0;
vy = 0;
friction = __fr;
}
}
}

package{
import Point;
public class PointAirFri extends Point
{
private var airFriction;
public override function verlet (a)
{
code
}
public function PointAirFri(__x:Number, __y:Number, __afr:Number)
{
x = __x;
y = __y;
dx = 0;
dy = 0;
vx = 0;
vy = 0;
airFriction=__afr;
}
}
}

if anyone has any idea why that error happens please enlighten me

View 2 Replies

ActionScript 2.0 :: Including The Custom Classes?

Feb 10, 2007

I have a few custom classes stored in AS files. Is it possible to have these classes imported another way from using the following method:

Code:
import ClassFile;

I want to have the AS files loaded from a server (policy file created for inter-domain talk) into to flash. Also I want it to work, if a person downloads the main SWF and plays it on their compy,i want the class files to be loaded from [URL] and so on.

View 5 Replies







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