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


Similar Posts:


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

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

Class - Flex Loading External Swf Prevents Other Functions?

Apr 8, 2011

I am able to use the Loader class to import an external swf into my project, its working great. But Im also trying to do a ImageSnapshot of the stage which works fine before the external swf is imported. After the swf is imported the ImageSnapshot no longer works. is there a event that the external swf is bringing with it that would disable it?

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 :: Understanding Doc Class And Adding Functions Via External .as File?

Sep 9, 2010

Say I have 3 fla files, each with it's own document class. I want to define some unique variables in each of those 3 files.Now once the variables (unique to each fla) are set, I want to call the same function - setting up the files. I want this function in a separate as file so i only have to make changes in one spot.How do I link the 1 .as file to each of the 3 doc class files and have it's function called in the constructor of each on

View 2 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

ActionScript 3.0 :: Importing External Actionscript Class Functions?

Jun 5, 2009

this is what i've been trying to do..this is the beginning of the external class:

Code:
package
{

[code].....

View 10 Replies

ActionScript 3.0 :: Creating A New Instance Fails When Base Class Is Assigned To An External Class File?

Jul 22, 2009

I'm trying to create a new instance of a MovieClip when the original one has been used. Would sound easy enough. Just use: var

instanceName:ClassName = new ClassName();

the class name/mc in the library im trying to duplicate is MCg1 so

var instanceName:MCg1 = new MCg1(); right?

However, the particular object in the library i'm trying to duplicate has a base class that is an external class file (just to control it's drag drop functionality)... i.e baseclass is not set to the standard flash.display.MovieClip, or whatever the case maybe. So i end out with a: TypeError: Error #1009: Cannot access a property or method of a null object reference.

View 6 Replies

Actionscript 3 :: Access Function In External Class Located In External Swf

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

ActionScript 3.0 :: Loading External Swf Which Attached With Its Own External Class?

Jun 27, 2009

Lets say I have Main.swf and sub.swf, and I wanna load sub when I press a button from Main, but sub.swf has its own external class file attached, so here is the problem, when I load sub using loader class and I would get this message from the output panel:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at subScript()

seems loader class can not access sub.swf's external class when sub is being loaded.

View 1 Replies

Actionscript 3 :: Big Performance Difference Between Using Class With Static Functions Vs Instantiated Class?

Mar 22, 2012

I'm wondering if anyone has experience with if there is a big difference in performance in ActionScript 3 between keeping a class with only public static functions, and utilizing those functions often (as in a frame event at 30fps), and in turning the class into a "normal" class of which I instead make an instance and call the functions via the instance instead.

View 1 Replies

ActionScript 3.0 :: Accessing A Class's Static Functions From A Variable Of Type Class?

Feb 19, 2010

I realize this is kind of an odd issue, but I am wondering if there's any way to get Flash to allow me to access a class's static functions using a class variable that points to the class. Example:I create a class called FooClass that has a static function named fooI then create a variable of type Class that points to it

Code:
var class:Class = Class(getDefinitionByName("FooClass"));
However, when I try to call foo() using the variable, it errors saying the function

[code].....

View 6 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

ActionScript 3.0 :: Call Document Class Functions From Outside Class?

Sep 25, 2011

Main is my doccument class . how can i call Main.Caller
 
package { import flash.display.Sprite; import flash.events.Event;
public class Main extends Sprite {
public function Main():void   {   if (stage) init();   else

[Code]....

View 2 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 3.0 :: Get Xml From External Class?

Feb 15, 2011

I'm trying to call an external API which returns XML, and i have no problem doing that.

Afterwards I wanted to refactor my code, and I moved my API call to an external API.as class, but how do i return the XML to my main class?[code]...

View 4 Replies

ActionScript 3.0 :: Accessing Class From External Swf?

Sep 29, 2010

I have created an SWFloader class that creates a container on the stage and loads an external swf into it. How can I click a hotspot in the external swf and make it instruct the loader class to load a new external swf? Basically, how can I access the SWFloader class from the timeline of the external swf?

View 1 Replies

ActionScript 3.0 :: Cannot Load External Class?

Mar 31, 2009

I'm using the tweener class in this file just fine. But whenI try to use the sound manager class I cannot get it to load why?I keep getting type was not found ....

import com.richardsongraphics.soundmanager;
var manager:SoundManager = new SoundManager();
=======================================

[code].....

View 2 Replies

ActionScript 3.0 :: Using DataProvider In External Class?

Oct 26, 2009

I am creating a Flash form which will include a drop-down selection menu from which a user may choose their state. I originally accomplished this by adding a ComboBox to the stage and then populated the ComboBox's DataProvider object with an XML listing of all the state names and the corresponding values. Everything works as expected.I have decided, however, that it would make the most sense to create an external class to accomplish the same thing. I have attempted to create such a class using the following code:
 
package {
import fl.data.DataProvider;
import fl.controls.ComboBox;[code]....

I am new to creating external class files so I am not sure why the new object is not populated with any data.

View 3 Replies

Professional :: Loading Class From External Swf?

Jun 14, 2010

I found some code that let's you load variables from an external swf. I'm trying to adapt it so that I can use the symbols from external swf library in my main swf. I get an error telling me 'call to an undefined method...' and then the name of the symbol I am trying to import to the main swf (testMe123_MC). Here's the code of my external swf as:

[Code]...

View 1 Replies

ActionScript 3.0 :: Run An External TimeDate Class?

Jul 31, 2011

package
{
public class TimeDate

[code]........

View 16 Replies







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