ActionScript 3.0 :: Flash Extended Document Class?

Jul 12, 2010

I'm having some trouble with using a Document class in Flash CS3 that is an extension of another class. When I do this, I can no longer make references to MovieClips with instance names on the stage.Here's an example. I have a class called Minigame that extends MovieClip and then a class Shooter that extends Minigame. So the relationship looks like:MovieClip <-- Minigame <-- ShooterI want to use Shooter as my Document class in the Flash file Shooter.FLA. However, when I do this, I am unable to directly access any instance names of MovieClips on the stage of Shooter.FLA from Shooter.as. In other words, if I try to write the line:var mc:MovieClip = this.instanceName;in Shooter.as, I get the error:1120: Access of undefined property instanceName.

View 1 Replies


Similar Posts:


Flash :: Access Object Property Or Function On Extended Class That Isn't In The Super Class?

Jan 29, 2012

If I have three classes:

public class Example {
public function Example () {
}[code]............

You can see that the two last classes extend the first one, and both have the 'variable' property. In case that I have an instance of Example and I am sure it is also an ExtendedExample OR AnotherExtendedExample instance, is there some way to access the 'variable' property? Something like

function functionThatReceivesAnExtendedExample (ex:Example):void {
if(some condition that I may need) {
ex.func()

View 3 Replies

ActionScript 3.0 :: Flash - Dispatching An Event From One Document Class And Listening For It Via Another Document Class?

Dec 14, 2010

I am dispatching an event from one document class and listening for it via another document class.My code in class A.

Code:
this.dispatchEvent(new MYEvent(MyEvent.APERTURE_DONE));
trace("Dispatching APERTURE_DONE");

my code in class B.

Code:
addEventListener(MyEvent.APERTURE_DONE, onDoorsOpen,true);
trace("Lisetning for APERTURE_DONE");

[code]....

My listener is registering before the event is dispatched, based on my output window, however I never get the "Open Doors" trace statement to fire.

View 2 Replies

Flex :: UIComponent Extended Class Isn't Showing UIComponent Extended Class

Aug 18, 2009

I have 1 class (that is extending a UIcomponent) that is representing a component. In that component I create different instances of another class that is also a UIComponent but this class doesn't show up in de first class. I see that it is running and that it has the correct hights but I got the feeling that it doesn't show up with this hights. If I trace I see the width and height is 200 X 200 but there is still nothing visible in my component.

View 1 Replies

ActionScript 3.0 :: Flash - URLRequest In An Extended Class

Jan 8, 2011

I'm new to AS3 and I'm having a problem with an extended class that uses a URLRequest. I have a basic class called 'imageLoader' that I use for loading in external images

[Code]...

View 2 Replies

ActionScript 3.0 :: Flash Can't Change TextField's Text Inside An Extended SimpleButton Class

Oct 18, 2011

I've created a Button in Adobe Flash CS5, it's a Symbol, and its type has been set to Button.

The button has a dynamic textfield with the instance name label.

I've set the class of this Button to MenuButton, and I've set the class to Export for ActionScript.

This is the code of the MenuButton class:

Code:
package
{
import flash.display.SimpleButton;
import flash.text.TextField;

[Code]....

Whenever I put a string in MenuButton's constructor, label's text doesn't change.

View 4 Replies

ActionScript 3.0 :: Calling A Function From An Extended Class Inside A Top Level Class

Sep 23, 2009

package{
public class Character{
protected var _hp:uint = 50; //Character Health Points
protected var _power:uint = 5; //Damage dealt

[Code].....

I`m instancing a Character and a Player in the Main Timeline, all in frame 1.
When I use: ""player.attack(character)"" it works fine by itself.

So I added the if (defender._hp <= 0) this.win() which gives me the following error:

1061: Call to a possibly undefined method win through a reference with static type Character.

"defender" is a Character instance, "this" is a Player instance and "win()" is a Player method. I try to call the Player method inside a Character method using the Player instance adding the "." and his method name

Do I really need to define the win() function in the Character class? Is there a bypass to use a subclass method in a parent class method if it`s called from an instance of the subclass?

View 6 Replies

Actionscript 3 :: Recasting Member Of A Library Class To New Type In Extended Class?

Oct 14, 2010

I created an flv video player using Flash Builder 4. This "BasicVideoPlayer" project is compiled into a SWC that will be eventually be used to create other video players that extend the functionality. One of the features is a view that appears when the video has finished playing that displays a "Play Again" button. This "Play Again" view has its own class, "BasicPlayAgain", that accepts a graphic asset that is exported from a .fla file that contains all of the graphic/UI assets.

In my new project, "EnhancedVideoPlayer", I'm using the BasicVideoPlayer SWC as a library to create a new video player that will add more functionality to the "Play Again" view; specifically it will add more buttons to that view.The EnhancedVideoPlayer uses a default class that extends the BasicVideoPlayer class. The BasicVideoPlayer class has a member called "playAgainScreen" whose type is BasicPlayAgain. The EnhancedVideoPlayer needs to override the playAgain member and recast it as EnhancedPlayAgain so it can control the new buttons properly.

View 1 Replies

ActionScript 3.0 :: Extended Class Doesn't Inherit Base Class Imports?

Sep 29, 2011

Let's say Class A has the flash.events.Event imported. Now let's say Class B extends Class A. Why in the hell do i need to import flash.events.Event in Class B? It makes no sens at all to me.

View 3 Replies

Actionscript 3 :: Linking Library Class To An Extended Class And Baseclass

Jan 22, 2011

The use of library classes confuses me once again. I have the following situation:

[Code]....

I cannot put in any baseclass when using the class, so I'm forced to remove the baseclass. When using only the class I get a whole bunch of errors don't make any sense at all, and still appear even if I comment out all the code in the Page class. comop_padpagesFavorietenPage.as:7: 1152: A conflict exists with inherited definition com.op_pad.pages:Page.help in namespace public.

[Code]...

View 1 Replies

ActionScript 3.0 :: Dispatch Event From Class That Isn't Extended Class Of MovieClip?

Oct 20, 2009

Is it possible to dispatch event from class that isnt extended class of MovieClip? I created my own class and put import flash.events.Event; import flash.events.*; but when i call dispatchEvent compiler throws error:"1180: Call to a possibly undefined method dispatchEvent."

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 :: Tracing A Class Extended From The Event Class

Feb 18, 2011

I have created a class (extends the Event class) for use in one of my projects. If I trace the custom event object in the called function I get 'Event' as the type, but if I trace a TimerEvent, or MouseEvent, etc, I get TimerEvent or MouseEvent... Let me demonstrate:

var c:CustomObject = new CustomObject();
c.addEventListener(CustomEvent.ON_SEND_MESSAGE,fnc);
function fnc(e:CustomEvent) {

[Code].....

View 1 Replies

ActionScript 3.0 :: Moving Document Class .fla Cannot Find The Document Class - WTF?

Sep 22, 2008

So I had a working .fla, with a document class package in the same directory. Everything was fine, until moving both to a new directory, now the fla cannot find the document class. WTF?

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

Flash :: Loader Class Problem Tracing The Swf (document Class)

Oct 12, 2010

I am using the Loader class to load 3 external swfs: sharedTopics.swf (does not have a document class) fonts.swf (document class is FontManager) main.swf (document class is Main) The same loader is used to load all 3 assets.

[Code]...

View 2 Replies

ActionScript 3.0 :: Flash - Calling Method On Document Class From Another Class?

Jul 5, 2010

I have a rather silly question but as3's document class always gets me confused.I have a public method on my document class. I want to call this method from another class that is instantiated from within an object in the library of the flash file (the same one on whose document class I want to call a method).

View 6 Replies

ActionScript 3.0 :: Flash Call A Function From The Document Class In Another Class?

Apr 20, 2011

I have a Document class that instantiates a class named Other. I need to call a function in the Other class from the Document class.I'm getting this error: Call to a possibly undefined method OtherFunction through a reference with static type Other.I have read online that you need to use make the functions static or use a getter function but I'm unclear how to do that. I haven't been able to make it work and I feel like i'm missing something fundemental with this problem.below are simplified versions of the classes.

Document class

Code:
package {[code]......

View 1 Replies

ActionScript 3.0 :: Extend A Class That Is Already Being Extended?

Jul 17, 2009

Ok, I have spent a little time searching and I can't seem to find an answer to my question, maybe I'm asking the wrong question. here's my situation:

I have a document class called Main.as, this class has variables that instantiate a CreateShape.as class that acts as a superclass. The CreateShape.as class has a protected function that is overridden by other classes (I have a CreateCircle, CreateSquare etc). Those CreateCircle etc classes, use extends to extend the CreateShape.as class, and thus have the ability to override the main method (called newShape()).

[Code]...

View 5 Replies

Flash - Listener In Main Document Class For Custom Dispatch Event From Another Class Does Not Respond Or Call Function?

Apr 1, 2011

I have a document class called Main.as In the class constructor I have the following listener:

enter code here
var listeningFORModeChangeToStudent:Sprite = new Sprite;
listeningFORModeChangeToStudent.addEventListener(TellAllModeChangeToStudent.STUDENT,exp);
addChild(listeningFORModeChangeToStudent);

[code]....

In a third class I make a call to the despatcher in the previous class:

enter code here
var ThisTellAllModeChangeToStudent:TellAllModeChangeToStudent = new TellAllModeChangeToStudent;
ThisTellAllModeChangeToStudent.tellAllModeChangeToStudent();

I have trace statements in eveything and from this I know the despatcher in TellAllModeChangeToStudent is being called.The problem is that the listener in the main.as is not calling the function exp.I cant see why and I dont know how to check if the listener is actually seeing the dispatch event?

View 1 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 3 :: Calling A Function From Another Extended Class?

Mar 29, 2012

I have my main stage, and I have two objects (blocks), these two objects both extend from the "Block" class. The "Block" class is NOT extended from the Main Class.I would LIKE to call a function, in either the "Block" class or in it's subclasses, from the Main Stage Class. The functions will do slightly different things depending which object you are calling the function (Added different things, and different number of things to an array). What is the best way to implement this?

View 2 Replies

ActionScript 2.0 :: LoadMovie In A Extended Movieclip Class?

Oct 15, 2010

i have this class but instancing it nothing appear

class myclass extends MovieClip
{
var mc:MovieClip;

[code].....

View 0 Replies

ActionScript 3.0 :: Hiding Properties Of Extended Class

Jul 23, 2009

Is there a way to hide properties or methods of an extended class?Ie, I want most of the extended properties and methods to be accessible but I want to hide others and use my own instead (not just overriding).

View 2 Replies

ActionScript 3.0 :: Capturing An Event From Extended Class

Nov 14, 2009

capturing an event from extended class. i am extending class B from class A. snippet form class A (ButtonControl):

[Code]...

View 5 Replies

ActionScript 3.0 :: Multiple Internal Classes With An Extended Public Class?

Jan 9, 2010

If I have a class that extends another, e.g.,
 
package {
import flash.display.Sprite;
public class MySprite extends Sprite{

[Code]....

and extend that class, if more than one internal classes are defined:
 
package {    
public class MainClass extends MySprite {         
public function MainClass():void{}   

[Code]....

ReferenceError: Error #1065: Variable MainClass is not defined.Note that this only happens (as far as I can tell) when the public class of the package extends another class, and multiple internal classes are defined. The internal classes don't even need to be instanced or referenced to generate the error (the bare-bones code above will error out). If only a single internal class is defined, it works fine (no error).  Even if the internal class is instanced.

View 11 Replies

Actionscript 3 :: Created External As Files That Extended A Class Such As Sprite?

Jun 11, 2010

i've only ever created external .as files that extended a class such as sprite. now i just want to create one that doesn't extend anything and call it from a frame script.

[Code]...

View 1 Replies

ActionScript 3.0 :: Find The Class Of An Extended MovieClip When Probing The Stage?

Feb 23, 2012

All my custom classes that extend MovieClip simply trace as "MovieClip" when using stage.getChildIndex(i); I'm trying to search the stage to see what objects have been placed and then add them to the correct array. E.g. if I place 5 "Enemies" on the screen, I want to then add them to an array by searching the stage for the "Enemies" class, without naming each one and adding it manually in the code.

Edit:

Code:
for(var i:int = 0; i < stage.numChildren-1; i++)
{
trace(getQualifiedClassName(stage.getChildAt(i)));

[Code]....

View 6 Replies

ActionScript 2.0 :: Dynamically Creating Instance Of Extended MovieClip Class?

Nov 6, 2006

I have recently started out with flash oop concepts and was wondering how to do create an instance of an extended movie class without dragging and dropping the clip from the library ....I have figured out this method..

for(i = 0;i<100;i++)
{var mc:MovieClip = attachMovie("ball","dasd"+i,_root.getNextHighestDe pth());
mc._x = Math.random() * 600;
mc._y = Math.random() * 600;
}

but this way I cant pass arguments to the constructor function of the ball class..

View 1 Replies

Actionscript 3 :: Accesing Function On The Maintime Line From A Extended Movieclip Class?

Feb 21, 2010

I have some movieclips on my main timeline with a class to extend these movieclips

[code]...

But the I can't 'reach' the testing function. I get this error: "1061: Call to a possibly undefined method testing through a reference with static type flash.display:DisplayObjectContainer."

View 1 Replies







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