ActionScript 3.0 :: Calling Methods Of A Class That Extends MovieClip?

Jan 31, 2010

I've got a class (say ButtonBase) that extends MovieClip. ButtonBase has a method that names it ((this.)name = 'bb1') and adds it to the MainTimeline. Now I can see my extended ButtonBase MC on the MainTimeline. And if from a frame I write trace(this['bb1']), it returns an instance. The problem is that the instance is not recognized as an instance of ButtonBase. Suppose ButtonBase has another method, say testMethod(). Well, if I trace(this['bb1'].testMethod) from a frame on the mainTimeline, it returns undefined. If I trace(this['bb1'] is ButtonBase), > false I can attach a fla if you need it.

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Write Class So It Passes All Of Its Functions/methods To The Calling Movieclip?

Nov 22, 2010

How do I write my class so it passes all of its functions/methods to the calling movieclip? For example, the following code imports my graphics class and creates a square:

ActionScript Code:
import sprites.vectorGraphics;
var vGX = new vectorGraphics();
var newSquare = vGX.createVector(this, 'square', 'rectangle', 20, 20, 0xff0000, 1, 0x0000ff, true);

That I'd like to be able to do is this:

ActionScript Code:
import sprites.vectorGraphics;
var newSquare = createVector(this, 'square', 'rectangle', 20, 20, 0xff0000, 1, 0x0000ff, true);

View 3 Replies

ActionScript 3.0 :: Error 1119 When Class Extends Another Class That Extends Movieclip

Jun 4, 2009

i came across this problem and i have no clue why it's happening. basically, consider 2 nested movieclips on the stage, something like stage -> main -> filler.  both movieclips have instance names (main and filler).
 
[Code].....
 
this throws an error 1119: Access of possibly undefined property filler through a reference with static type A. can anyone give me a hint on that, as it works with class A, but not B extending A? i understand it was meant to work?

View 11 Replies

ActionScript 3.0 :: Flash Class Object Calling Methods

Dec 7, 2009

I have a class file named Main.as and another class called icon.as

package {
import icon;
public class main {
public var _time:String;
function main() {
[Code] .....

How do I get the current update from the main class without calling the MainObj repeatedly. Is this possible in Flash AS3, or any other alternate method for this idea.

View 2 Replies

ActionScript 3.0 :: Calling Stage Methods From With MovieClip

Dec 14, 2009

Hypothetically, I have a movieclip menu that's created using a class menu.as at runtime. When I instantiate that class on the stage of the main swf, how would I go about telling that stage what to do on a specific click? For instance, if I click button1 on the menu, how do I tell the stage to turn random_object's alpha down to 0?

Important note - buttons in the menu class are loaded dynamically, and there is no way (that I know of) of binding them specifically to event listeners on the main swf stage as in "menu.button1.addEventListener(...)". To summarize my question - how do I control the main stage from within a movieclip, without assigning eventListeners on that main stage?

I have managed to make it work using this method: Inside the class, I add an event listener to each button. On CLICK, the button calls e.currentTarget.root.desiredFunction() where desiredFunction is the function on the main swf stage I want to run. Is there a more efficient or clean way of doing this that anyone knows of?

View 6 Replies

Actionscript 3 :: Can A Document Class Extend Another Custom Class That Extends MovieClip?

Aug 16, 2011

If I have a Document class that extends MovieClip, and I want to use it as the basis for another Document class, is it possible to create a subclass that extends the main document class and use that for a different FLA?

For example,

fla1.fla has a document class of MyMainClass:
public class MyMainClass extends MovieClip
fla2.fla has a document class of MySubClass:
public class MySubClass extends MyMainClass

I've tried, but now I'm getting errors that all of my variables that reference stage instances aren't being found.

View 1 Replies

Actionscript 3.0 :: Custom Var On Class That Extends MovieClip Class?

Sep 27, 2011

If I can create dynamic variables on a MovieClip.. why would I not be able to create dynamic variables on a class that extends MovieClip?

[Code]...

I created from a mc symbol in the library. it works fine, except for adding the custom variable.. .. which I need to be able to do.

View 7 Replies

ActionScript 3.0 :: Cast A MovieClip To A Custom Class That Extends MovieClip Called MovieClipExt

Jun 4, 2010

i'm trying to cast a MovieClip to a custom Class that extends MovieClip called MovieClipExt

ActionScript Code:
package {
import flash.display.MovieClip;

[Code]....

...but sadly returns null instead of a MovieClip converted to MovieClipExt

what should i change to make this work?

View 3 Replies

ActionScript 2.0 :: Class Extends Movieclip?

Feb 15, 2006

in human.as:

class human extends MovieClip {
function onEnterFrame() {
_x += 10;
}

[code]....

in my fla:

Object.registerClass(skin1, human);
_root.attachMovie("skin1", "User1", 1);

so i have an attached movieclip on _root now, i can see it but the onEnterFrame function doesn't work. Why??

View 4 Replies

ActionScript 3.0 :: Target MovieClip That Class Extends?

Jun 22, 2011

Is there any way to get the name of the MovieClip that a class extends?Lets say I have an MC on stage called boxMC exported for AS using a class box which extends MovieClip.If I trace (this) within my class I will get the name of the class, if I trace (parent) I will get the name of the main MovieClip that boxMC sits within. So how can I target boxMC?Basically I want to be able to return the name of the MovieClip that the class is extending

View 2 Replies

ActionScript 2.0 :: Class MovieClip Extends MovieClip?

Aug 26, 2005

I was just wondering if there is any easy way to extend the MovieClip class itself, without making a new class? I'd like it to be equivalent to using MovieClip.prototype ... or should I just use prototype?

View 5 Replies

ActionScript 1/2 :: Class Extends MovieClip But Can't Call 'addChild'

Sep 1, 2009

I'm working on a Flash Lite 3.0 application using AS2 and I've created a class that extends MovieClip. The problem is that I'd like to dynamically add Child Movieclips using the addChild method... but it doesn't work, it gives me the following compiler error: "There is no method with the name 'addChild'". But I can call other MovieClip specific methods such as this.getNextHighestDepth()
 
heres a reduced version of my class: 
 
class com.sck.DragList extends MovieClip {
//Declarations
private var placeHolder:MovieClip;
private var listMask:MovieClip;

[Code]......

View 3 Replies

Professional :: Inheritance - NewChars Class Extends MovieClip

Oct 6, 2011

I am having trouble using inheritance, I made a class called newchars_2 that extends my class newchars and i get this error (newchars class extends movieclip):
1203: No default constructor found in baseclass newchars.

newchars_2.as:
package {
public class newchars_2 extends newchars {
private var obj_no = 3;
public function newchars_2() {
//contructor class
}}}
And when I want to import this class do I import both the class's or just newchars_2 because it has all the functions inherited?

View 11 Replies

Actionscript 3 :: Class Which Extends MovieClip With A Dynamic Image?

Aug 11, 2010

I need to make an item draggable (dragable?) Sorry if my terminology is not right!I have a class where I will store variable and do calculations:

package Classes
{
import flash.display.*;

[code].....

View 1 Replies

ActionScript 3.0 :: Create Object From Class That Extends MovieClip?

Sep 6, 2009

googled it and hardly found any answer(seriously)need a quick solution for this:- How to create object from class that extends MovieClipSay i have a class name MC

Code:
package {
import flash.display.MovieClip;

[code].....

View 3 Replies

ActionScript 3.0 :: Create A Property For Class That Extends MovieClip?

Dec 23, 2009

I'm beginning to learn AS3. I'm getting the following error[code]...

View 5 Replies

ActionScript 2.0 :: Class To Call Player That Extends MovieClip?

Apr 7, 2006

I have a class called Player that extends Movieclip? Why wont my code to attach a movie clip work?
Code:
import GAME_CLASSES.*;
Player1 = new Player()
Player1.setName("BobZdog")
Player1.attachMovie( "MainChar" , "Character1", 75)
Player1._x = 100
Player1._y = 100
[Code] .....

View 2 Replies

ActionScript 2.0 :: Built A Class Which Extends MovieClip An Works?

Sep 16, 2006

I've built a class which extends MovieClip an works ok. In this class i'm creating some MCs.and this part works ok.Before i've built some prototypes which adds some methods to the MovieClip object I'd like to use these methods in the class i've created.

But using the include before the class statement throws an error during compile

How can i do to add the methods in the prototypes to my MCs in my class?

View 2 Replies

ActionScript 3.0 :: Turn On CacheAsBitmap Inside Class That Extends Movieclip?

Nov 15, 2010

I've recently started using the cache as bitmap switch on my on-stage movieclips, to great success, while creating my isometric RPG. What I can't grasp though, is how to apply it to AS-instantiated classes/object.How can I turn on cacheAsBitmap inside a class that extends movieclip? Alternatively, how can I do it from outside the class, from another class that adds mentioned movieclip to the stage?

View 1 Replies

Flash :: Access A Symbol From Inside A Class Extends Movieclip?

Oct 14, 2011

I created a movieclip symbol and exported to actionscript, I created the .as file:

class BRIQUE extends MovieClip
{
function BRIQUE()
{

[Code].....

"graphics" is an image imported on the stage inside my symbol, but it seems not to be accessible this way (I get an error), nevertheless it works this way in as3 then what is the right way in as2 ?

View 1 Replies

ActionScript 3.0 :: Document Class Extends MovieClip Type Stuff

Mar 8, 2012

What I've done is I have an existing fla file I'm using on line, which I want to use a document class, something I've never done. The as file I have (using Alternativa 3D 7.8) extends movieclip - here's the basic structure:

package {
import alternativa.engine3d.containers.ConflictContainer;
import alternativa.engine3d.core.Camera3D;
import alternativa.engine3d.core.View; etc.
public class test5 extends MovieClip {
private var container:ConflictContainer;
private var cam:Camera3D; etc.
public function test5() {
// constructor code
}}}

The thing is, it works fine when I use a blank fla (class named test5) but when I apply it to my existing fla - which uses a a mile of actionscript - all of my dynamic images dissappear and I'm left with the image from my as file (test5).

View 0 Replies

Actionscript 3 :: Loading Swf As Custom Class That Extends MovieClip - Getting Null Object Reference

Aug 16, 2011

I followed the example from a previous question and I am loading an external swf using a loader and inside the loader event handler I am trying to cast the loader.content as my custom class PanelReferenceClip which extends MovieClip

When I publish I receive a this error:

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

Just to make sure and test that the swf location was correct and the swf was actually being loaded, I changed the type of the content to as MovieClip and it worked fine.

EDIT: I also wanted to add that these swfs are being stored locally and not being pulled across the internet, multiple networks or servers.

I am not sure if I did something quirky in my class so I am providing the source to my custom class PanelReferenceClip

package com.components
{
import com.UI.DevicePanel;
import flash.display.MovieClip;

[Code]....

View 3 Replies

ActionScript 3.0 :: Add New Methods To MovieClip Class?

Aug 5, 2010

Is there any way to add methods to the existing MovieClip class so that later I can use them everytime I instantiate a MovieClip? Something like this:

PHP Code:

package {    import flash.display.MovieClip;    public class myClass extends MovieClip {       public function myMethod() {         //do stuff       }   }} 

Then, without instantiating myClass, I want to be able to call that method like this:

PHP Code:

var newMc:MovieClip = new MovieClip();newMc.myMethod(); 

View 4 Replies

ActionScript 3.0 :: Accessing MovieClip Methods From A Class?

Oct 17, 2009

Here is the situation:I have created a movieClip named "tp_crack" on the timeline and created its class using linkage called "tp_crack".The tp_crack mc is like a small rectangle which breaks in 3 seconds when it is played.I have a seperate class in which I have used tp_crack to create many instances of tp_crack going by the names: cracked1","cracked2" etc.These instances are present in another movieClip (this time created within the class) called "crackContainer".Now I have added the following code to check for hitTest of those cracked1,2,3...... with a spaceship.The hitTest works but flash does not recognize the pieces as movieClips and does not play them as required, instead it gives me an error saying:1061: Call to a possibly undefined method play through a reference with static type flash.displayisplayObject.

for (var i:uint=0; i<crackedPieces; i++) {
if (crackContainer.getChildAt(i).hitTestPoint(Spacesh ip.x,Spaceship.y+(Spaceship.height/2),true)) {

[code].....

View 4 Replies

Flash :: MovieClip Can't See Base Class Methods?

Aug 12, 2010

I have this base class

package sevengames.miranda.front.res {
import flash.display.MovieClip;
import flash.text.TextField;

[Code].....

I then, in the Flash document, create a movie clip which has this class set as the "Base class" in the properties. However, if I then do this.updateText(); in the movie clip's frame script, it complains

TypeError: Error #1006: updateText is not a function.
at miranda_fla::MenuButton_3/frame1()

Why doesn't it work? I know the class is read and compiled, because I had an error there which was reported.

View 4 Replies

ActionScript 3.0 :: Add Custom Methods To MovieClip Class?

Dec 13, 2010

I want to add a custom method so that any MC can use it like this - Code:text1.fadeIn(2) - which would fade text1 in over 2 seconds. The actual method isn't important, it's the way to add it as a custom method for ALL MCs that is confusing me.I can add it inside the document class (that extends MovieClip) like{/*fade in over tt seconds etc*/};But pretty much everywhere I look peoples are choking on their coffee shouting not to use that method. So is there a nice, clean way to do it without using prototype?BTW I want to add these methods in a class that is imported into the main document class at compile-time. So my main doc class has code specific to this SWF but the general external classes like Effects and Transitions are imported as needed.

View 6 Replies

ActionScript 2.0 :: Using MovieClip Methods In Custom Class?

May 30, 2005

I've got a custom class (using AS2) that mostly does things like set the score and level of a game, as well as sets the player's lives on the screen. I need to unload and attach MovieClips within the Lives control function, which require those methods from the MovieClip class. I don't think I need to extend this class from the MovieClip class, I think I need to import the class somehow. I don't know the path though..something like mx.MovieClip.

View 3 Replies

Flash 9 :: Access Document Class Methods From Within MovieClip?

Aug 27, 2008

Let's say I have a FLA file with document class called main. In main, let's say I have a method called test1 that just outputs "hello world" via trace. On the FLA I have a movie clip. In that movie clip, when the timeline reaches frame 123, I want it to invoke the test1 method (I just set up a simple action on the frame). However, I get an error saying that the method is undefined. I try this.parent.test1() too but that gives me the same error. Is it not possible to invoke a document class property from within the timeline of a movie clip that's on the stage?

View 2 Replies

ActionScript 3.0 :: Create A Custom Class That Extends The MovieClip Class And Contains A Custom Property Of "marker"

Jan 23, 2010

I am new to AS3, as well as Flash in general, so forgive me if this seems highly elementary. All I am trying to do is create a custom class that extends the MovieClip class and contains a custom property of "marker". I want to be able to use and change the value of this custom property on the timeline for an instance of this class and have it behave just like any other (Ex: this.x ==> this.marker).

[Code].....

View 13 Replies

ActionScript 3.0 :: A Super Class That's Runtime Shared Independent From The Class That Extends

Nov 4, 2010

I'm not really asking how. What I'm asking is, is it possible? And I ask because I thought it was not - certainly it didn't work in AS2 - and yet that's what I appear to have done. Am I going crazy? Structure: A SWF (#1) with a class NewActivity that extends class AActivity. Another SWF (#2) with a shared library of code in it, including AActivity. A third SWF (#3) which loads the library followed by SWF#1. Here's what happened: I didn't expect AActivity to be able to be shared. I mean, it should be compiled no matter what in SWF#1, as SWF#1 includes a class that extends AActivity. I had added some properties to the AActivity class, ran the project, and when SWF#3 tried to set those properties I was told they couldn't be applied. "Of course", I said, "I need to recompile SWF#1, because the code is now out of date. The version of the class there doesn't include these new properties.".

However, that didn't work. I got the same problem. Maybe, I thought, there's a definition conflict between SWF#1 and the library, so I removed the AActivity class from the shared library in SWF#2 for the time being. Only SWF#1 uses it, and it should already be compiled into SWF#1 as, like I said, it is extended by another class there. But when I ran the project, I was then told that the AActivity class could not be found at all! Looking at SWF#1 in a decompiler, there is in fact no mention of AActivity (I had up to this point assumed it was implied). So this left just one option: I needed to recompile the library in the first place, not SWF#1. I added AActivity back to the library, recompiled, and it worked.

To check I wasn't going crazy: I added a test property to the AActivity class and recompiled the library. The containing project - SWF#3 - then set this property on SWF#1, which had NOT been recompiled, and then read it back out. No errors. I should point out that the getting/setting of this property is done through an IActivity interface - AActivity is not being accidentally compiled into the main project (SWF#3), and the decompiler indicates this also. Am I going nuts? I really didn't think having a runtime shared super class was possible in any way. If it is, that opens up a whole new world of awesome, even though I've created this project on the basis of that being impossible.

View 4 Replies







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