ActionScript 3.0 :: Reference External Class Using It?

Feb 11, 2009

How do we create a class file and use it in seperate flash file

View 0 Replies


Similar Posts:


ActionScript 3.0 :: Using An External Class To Reference Functions From Another External Class?

Mar 25, 2010

I have a Main.fla which loads Main.as as its document class. In Main.as I have a public function named "Main" which runs a trace. I also have another .as file called Preloader.as, which also has a public function in it, this one named "Preloader" with simple trace in it. I just cannot figure out how to use Preloader() from the Preloader class in Main() from the Main class. Main.as loads up fine when the SWF loads and traces.

View 10 Replies

Flash :: CS, Reference Root From External Class?

Dec 21, 2010

I made this class and I put it in the same package of Timeline.as (the Document Class):

package {
import flash.utils.Timer;
import flash.events.TimerEvent;
public class Counter2 extends Timer {
public function Counter2(delay:Number, repeatCount:int=0) {

[Code]...

View 1 Replies

Flash :: Loading External SWF W/ Stage Reference In Class

Nov 17, 2011

I'm unable to load forces.swf (assume I can't edit it, as I don't have the source code) through an external swf, due to Stage reference in the base class how would I go about loading it (and any other possible SWF) without errors being thrown?

Here is a link to the problem I am trying to fix:[URL]..

View 1 Replies

ActionScript 3.0 :: Loading External SWF With Stage Reference In Class?

Nov 17, 2011

I'm unable to load forces.swf (assume I can't edit it, as I don't have the source code) through an external swf, due to Stage reference in the base class.

How would I go about loading it (and any other possible SWF) without errors being thrown?

Here is a link to the problem I am trying to fix:

[URL]

View 14 Replies

ActionScript 3.0 :: Passing A MovieClip Reference To A Function In An External Class?

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

ActionScript 3.0 :: Reference Movieclip Instance On Stage From External Class File?

Nov 21, 2010

I've been searching around all afternoon, and am pulling my hair out. 1) I have a movieclip instance on stage (simple graphical element that represents platforms for a hero to run and jump along). I have placed it on the stage with an external class engine.as and in this class it is called myPlatform and is an object of Platforms.as. The movieClip is called platforms and from a trace(myPlatform.name) the instance name is instance3.

2) I am attempting to access the properties of myPlatform in an Enterframe event loop in my character control and collision class (called hero.as)

Basically here is the bit of code I am trying implement within Hero.as :

[Code]...

This all worked when I was writing actionscipt within the FLA file, on the timeline frame 1. I simply don't know how to access myPlatform from within the external Hero.as class! Do I need to create a variable? Is there a really easy way to do this with some syntax/command that I have not learned yet?

View 3 Replies

Flash :: Reference The Default `this` Reference In Actionscript3 From An External Package?

Jul 7, 2011

My code is an external .as file. Google provides this code on their demo, which contains the this keyword:

[Code]...

Notice that I have 4 calls to console.log. The first 3 fire, but after the new GATracker statement, the 4th does not fire. I have a feeling that I'm overriding the entire package with the object created from new GATracker when I should be passing a different context. I believe the correct context I should pass is whatever this defaults to when not inside of a package/external file, I assume it references the main stage object.

View 2 Replies

Actionscript 3 :: Flash CS5 Reference A Display Object From A Class Other Than The Document Class

Jul 28, 2011

Using Flash CS5 Professional I have created a symbol, dragged it onto the stage, and given it an instance name of GreenLight1. If I want to make this visible from the document class, I can simply do the GreenLight1.visible=true; and poof it's good to go when I test the file. As long as I stay in the document class I am good to go, but now I'm trying to move to another class and hitting ALL kinds of trouble just trying to get Flash to allow me to access this simple object. All I am looking to do is have this GreenLight1 go invisible (visible=false) when a certain condition occurs in this new class and Flash just won't let me access GreenLight1 at all. Things I've tried thus far:

stage is passed to the class and is referenced by _stage and is working just fine when I do _stage.addchild or anything like that. So I have tried "_stage.GreenLight1.visible=false;" and I get "ReferenceError: Error #1069: Property GreenLight1 not found on flash.display.Stage and there is no default value." My document class extends Sprite, so I figured I'd try the root function. So I tried "Sprite(root).GreenLight1.visible=false;" and I get "1119: Access of possibly undefined property GreenLight1 through a reference with static type flash.display:Sprite." I tried to create the Resource class as described therein. To which I came across the same problem that I started with in that it doesn't know what GreenLight1 is to begin with so I got "1120: Access of undefined property GreenLight1." Here is my code for Resource.as (am I supposed to pass something to this class from the document class?)

[Code]...

View 2 Replies

ActionScript 3.0 :: Reference Movieclip On Stage From Custom Class Of Document Class

Dec 7, 2009

Is there a way I can reference a Movie clip I have on the main stage from a custom class of a document class?[code]

View 1 Replies

ActionScript 3.0 :: Reference Movieclip On The Stage From A Class Of The Document Class?

Dec 8, 2009

Is there a way to refer to a Movieclip on the stage from a class file of the document class

Lets say I have 3 MovieClips on the stage(a Circle, a Square and a Triangle)

I have the document class which calls another class that controls the MC on the stage

Example

ActionScript Code:
package {
public class Example extends Sprite {
//Create the instance of the class being called

[Code]....

View 1 Replies

Flex :: Difference Between Class Reference And Class Instance?

Jun 28, 2010

Given that both of these calls to getQualifiedClassName return the same thing (mx:Label), how would one go about programatically differentiating between an instance of a class and a reference to the class...

var lab1:Label=new Label();
var lab2:Class=Label;
var qcn1:String=getQualifiedClassName(lab1);
var qcn2:String=getQualifiedClassName(lab2);

In other words, how could I know that lab1 is of type Label, while lab2 is type "Class". typeof() simply returns "object" for both... getQualifiedClassName returns "mx.controls::Label" for both...

View 3 Replies

Flash :: Use A New MovieClip As A Class Or To Copy It Without Reference To Its Class?

Jul 21, 2011

I am doing a looping background with 2 identical BG movieClip (B1 and B2). Those 2 are "new" by the same class.

var B1:MovieClip = new BG();
var B2:MovieClip = new BG();

But because this BG class picture is loader from the internet and the picture is rather big. When I addressed its loading by using progressEvent. The picture is really loaded 2 times. Is there anyway I create B2 based on B1 without using new BG() again? Since it definitely makes a new BG with Loader code inside.

[Code]....

View 2 Replies

Actionscript 3 :: Pass A Reference To Class Into Another Class?

Jan 8, 2012

The question is a bit silly. I am trying to implement a skill updating system. So to explain.There is a class

class AppInfo
{
public static var power:int = 10;

[code]......

View 3 Replies

ActionScript 2.0 :: Get Var Reference To Instance Of Class From Within The Class?

Mar 15, 2006

I want to retrieve the var reference of an instance of a class from within the class. For example:

ActionScript Code:
var ref:MyClass = new MyClass ();
//then via some method, I would like to get the var ref inside the class
ref.getRef(); //returns "ref" instead of [object Object]

[Code]....

You may ask why, well I want to do some spring cleaning inside this manager class I am making. Of course the above is a simplistic version of what I am trying to do.

View 2 Replies

ActionScript 2.0 :: Self Reference To A Class Instance Within A Class?

Jan 7, 2005

how can I self refer to an instance of a class within the class definition file?Here is an example

PHP Code:

public function fireBullet(target:MovieClip) {
Bullet_mc = target.attachMovie("Bullet", "Bullet1", 1);
}


Now everytime I want to call the function I have to put this as my target, (fireBullet(this))I cannot just put it in the code as it gives me an error.

View 9 Replies

ActionScript 2.0 :: Does "_root" Reference The Root Of The External Swf Or The Swf That Contains The External File

Mar 3, 2007

If you load an external swf into a movie and this external file references "_root", does "_root" reference the root of the external swf or the swf that contains the external file?

View 3 Replies

ActionScript 3.0 :: Reference Main Document Class From Document Class Of Loaded Swf

May 7, 2011

I have a FLA (say Main.FLA) document class with a child MovieClip on the stage: into the child MovieClip I load other swf files: each of the files contains its own Document Class (every swf is a somewhat independent application, say quizzes and so on).For some reason I must use the Main document class to store data (scores or so) from the child swfs loaded into the Main swf. HOW do I reference the Main class? I can't find a way.[code]and dispatch an Event this way from the loaded swf document class to the Main class:[code]Now, first of all I don't know if this could even work. Secondly, I tried to make it work by adding an event listener to my Main class but id did not work.

View 9 Replies

AS3 :: Extract Class Reference From Swc

Apr 8, 2011

Does anyone know how to extract a class reference from an SWC file? I know I can right click / "Go to definition", and view the class definition. I need to extract these for each class in an SWC. Can anyone provide a method to do so automatically?

View 3 Replies

ActionScript 1/2 :: How To Reference To External SWF

May 30, 2011

I'm new round here so sorry to open with a question. Flash isn't my area  of expertise at all, but if anyone needs help with Photoshop or Joomla then I might be able to help! Anyway - my problem. I had a SWF which interacts with a component SWF. I want to remove the  component and replace it with an external SWF. I've created a SWF which  contained only the component. I'm then loading that using the following AS2 code:

Code:_root.createEmptyMovieClip("my_ssp", 1);
container._x = 0;
container._y = 0;

[code]....

View 6 Replies

ActionScript 2.0 :: External Reference Of PPT Or PDF?

Jul 18, 2008

I'm working on a project for a client who wants to embed a 37 page Power Point presentation in a Flash application. Based on past history, I am 100% certain that this client is going to be making changes to this down to the last minute (adding pages, changing copy, removing pages, etc.) so I thought that it would be best to externally reference the whole thing if possible. I was further thinking that the easiest thing to do would be to just export the whole presentation as a PDF and use that. So I'm wondering if anyone knows of a component of some sort that we could purchase that would allow viewing a PDF internally inside an interface, kind of like how you can preview books onI know that we can go out and grab the PDF using code like this:

ActionScript Code:
getURL("myFolder/myPDF.pdf", "_blank");

View 2 Replies

ActionScript 3.0 :: Reference To A Class Instead Of Object

Feb 20, 2009

Is it possible to have a reference to a class instead of an object? [code]so that you can then use static vars of those Classes? from the var b?

View 3 Replies

ActionScript 1/2 :: Reference The Stage From Within A Class?

May 25, 2010

I'm trying to get a small popup (a volume bar) to work from within a class.I made a piece of actionscript code that creates an empty movieClip and draws the bar into it and made it onto a class. The only thing I now have to do to add the bar to a programm, is create an instance of that class. Nothing needs to be added to the stage.The problem I encounter is that I need the bar to stay on top. New movieclips always get higher depths (using getNextHighestDepth()), so that's a problem.Calling swapDepths() for every new movieclip is far too complex and afaik there is no such thing as "bring to front" in actionscript, it only exists at design time, not at runtime.

So I though I'd use 2 layers/movieclips in the timeline, one for the volume bar and one for the rest, and add an empty movieclip to both.This way I know that all children I add to one movieclip will alway lay below anything I add to the second movieclip. (or is there an easier way to accomplish what I need? Levels maybe? I've never looked into levels, I only know they exist when loading a clip)This means I need to add a some extra stuff to the stage at design time, but if this fixes the issue.. ah well.But how can I access that movieclip from within a class? The reference "_root.volumeBarPlaceholder" works from within the main actionscript, but not from within a class because I get the compiler error "There is no property with the name '_root.volumeBarPlaceholder'";

View 2 Replies

ActionScript 3.0 :: Reference The Stage From A Class?

Sep 13, 2010

How do I reference the stage from a class? I need to add eventlisteners to the stage for mouse movement. I also need to add custom cursors. I always get an error when I try to reference stage. anything. Or event if I do this:

[Code]...

View 20 Replies

ActionScript 3.0 :: Create A Reference To A Class?

Oct 15, 2010

I can't figure out how to create a reference to a class so I don't have to keep typing the class.staticvar.item

So usually I have this: DocClass.build_class.firstFunction();
 
I would rather in my sub class just be able to say; private var build_class:Class = Class(getDefinitionByName("DocClass.build_class"));
 
so throughout the sub class I only have to type the reference, build_class...
 
What am I doing wrong?

View 11 Replies

ActionScript 3.0 :: Reference A Textfield From Within A Class?

Dec 20, 2011

I have a dynamic textfield on my stage that I was to change from with a class method. I have tried all permutations of "parent", "stage" and "root" to try to access this item but none are working.

View 3 Replies

Actionscript 3 :: Cant Reference Array Class?

Feb 3, 2011

I have a class consisting of a nested array called twoDArray.

public class TestArray
{
public function TestArray() {
var twoDArray:Array = new Array(new Array("one","two"), new Array("three", "four"));
}

[Code]...

I thought I would be able to reference OrbArray for example using trace(OrbArray[0][0]); giving me the output I am looking for of "one". When I attempt this I get ReferenceError: Error #1069: Property 0 not found on com.orbclasses.TestArray and there is no default value.

View 2 Replies

ActionScript 3.0 :: Passing A Reference To Class

Nov 12, 2009

if i have multiple movieclips on the stage and i am writing a document class and in document class i import another class and i need to pass these movieclips to that class.

View 1 Replies

ActionScript 3.0 :: Get The Reference To The Class That Created Mc?

Jul 8, 2010

I have:

Code:
// a class
package
{

[Code].....

how to get the instance of AA that created this mc the_class.big_function( ) ;

View 9 Replies

ActionScript 2.0 :: How To Reference To Parent Class

Mar 21, 2008

I have a site class with different properties. The site class creates a Background class. I want the background class to use the Site class' stylesheet object. How can this be done?At first I thought about passing the site object to the Background class' constructor, but maybe there is a way to reference to the calling class?

View 8 Replies







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