Actionscript 3 :: Two MovieClips Sharing The Same Class?

Jan 1, 2012

I have two MovieClip symbols in my library and I want them to share the same class, but Flash doesn't allow me to assign the same class to any two different MC symbols, so instead I created two bogus classes which extend the class I wished to share initially.

So having two MC symbols defined by 2 different classes extending a different class allows me to share the same piece of code.

My Question: is there a better was to share a class between 2 or more different library symbols?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Sharing Vars Between Document Class And An Imported Class?

Jan 27, 2009

I've been sorting through the XML docs and i've bumped my head into a bit of a question. So, to preface, I have been able to load the XML successfully, but I want to be able to use my own XML loader class to load the XML and then be able to reference it from the document class. Also, I'd like to be able to send a file path to the loader class when I call it.

The document class:

ActionScript Code:
package rg.sites{
// flash classes

[code]....

View 8 Replies

ActionScript 2.0 :: Bunch Of MovieClips - Sharing One Mask Dynamically

Feb 3, 2005

I'm trying to dynamically generate a menu for a site. I have one movieclip that I duplicate and I want all those duplicates to share a mask.

Code:
for (i=0; i < 5; i++) {
_root.menuitem.duplicateMovieClip("menuitem"+i, i);
_root["menuitem"+i]._y = menuYpos;
menuYpos += 35;
_root["menuitem"+i].setMask(myMask);
}

This causes only the first menuitem to use the mask. After some searching i found that i should combine all these generated movieclips into one container movieclip and ultimately mask that container with myMask. I tried some createEmptyMovieClip, attachMovie & setMask combo's but it doesnt seem to work.

View 3 Replies

ActionScript 3.0 :: Two Symbols Sharing The Same Class?

Jul 25, 2011

In my library I have a few symbols (with diffrent graphics) that I want to share the same class (the same methods I written in as3).

First I tried to set the same name on the class line when converting to symbol but Flash then tells me that the name have to be unique. So I tried diffrent ways of inherit the class in each symbols custom class, but I didn't get that to work either..

View 1 Replies

ActionScript 3.0 :: Instances Of A Class Sharing 'this' Value?

Feb 3, 2010

I have four instances of the same class called Tile, that is bound to a movieclip with four frames. They're imbedded in a movieclip that I'm using to hold all of the visuals.In the main class of my .fla I declare a variable called menu1 that is bound to another movieclip with 2 buttons on it.

I'm trying to make three things happen here: on clicking the Tiles the menu will pop up over the tile that was clicked; that on clicking another tile when the menu is already up it will close that one before adding a new one; and lastly, that on clicking the second button in the menu, it will change the frame of the tile clicked and close the menu.The tile.as has an addeventlistener in it's construction method to add the function onTileClick to each Tile.

public class Tile extends MovieClip{
public function Tile():void{
addEventListener(MouseEvent.CLICK, onTileClick);[code]....

This works fine for one tile. I can click on it, the menu pops up, I can close and reopen the menu as many times as I want, and I can use the other button with no problems.Also, clicking around on different tiles moves the menu around without repeatedly adding it, so that seems to be working fine as well.The problem is this: If I click on a tile, close the menu, then click on another tile and close it, I get an error 1009.It still closes, that error just comes up. And it will come up for any more tiles I open and close it on.Then, after clicking on however many tiles, if I do click the advance button, it affects all of the tiles, and I get an ArgumentError: Error #2025 for each tile clicked on.I tried adding a variable that held the event.target value in the onAdvance function, and using that for the gotoAndStop, but the same thing happened. When I tried tracing the name of the variable, I noticed that it was tracing the names of each tile clicked with each subsequent trace.

Am I building this all wrong?I thought that making a class for my tile object, and adding eventlisteners to the class, and adding the functionality of the tiles inside of the class would be good practice for Object Oriented Programming, but it seems to be producing nothing but errors. When I defined these tiles inside the main timeline, with separate event listeners, I didn't have this problem

View 3 Replies

ActionScript 3.0 :: MovieClip: Parents And Sharing Class Definition?

Jan 15, 2010

Is there any way for movieClips to share the same class definition?When you have alot of objects to keep track of it becomes a pain to have to write separate actionscript files to do the same thing.For example if I:Create an actionScript file which extends movieClip with the name ClassX.as with all the nescessary code incased in package{}I try properties>export for actionscript>ClassX.as for two movie clips (each with different graphics).An error occurs on the 2nd movieClip complaining that the class I used was not unique. y other question is how do I make an actionscript file file that both extends a movieClip and another class.For example:In a game there is a movieClip for an enemyShip1 with its own class definition contained in an actionscript file (defining its behavior)There are 2 child objects enemyShip2A and enemyShip2B each of which have there own images,class definition but which inherit all the functions from the enemyShip1Class.It would seem that the logical thing to do would be:

package
{
//import extentions.*

[code].....

View 2 Replies

ActionScript 3.0 :: Class Linkage - Generic Class Accessible To All MovieClips From Within Flash?

Feb 23, 2011

Assume I know practically nothing about AS3! I'm using Flash Pro CS5. I'm trying to reassociate a flash file I've been given with its external assets and classes. In the library I have a movieclip with linkage to a class called 'StaticMap' using the base class 'flash.display.MovieClip'. am I missing a custom class file called 'StaticMap.as' that was originally located in the same folder as the fla, or is this a generic class accessible to all movieClips from within Flash?

View 7 Replies

Adding Movieclips To Object Class?

Aug 25, 2010

I am building an image gallery which has a very simple design. The gallery has a button area, where the buttons are movieclips, and an area where there are images, which are also movieclips.I am using flash CS3, AS3.Each time I use an eventlistener to tween the alpha value of each image (the brightness) when the button movieclip is pressed, I must call a command to reduce the value of every OTHER image that is in my gallery as well as increase the alpha value of the single image I want.This means I have a lot of typing and I was wondering if there was an easier way to manage my movieclips, such as to use the Array class or the Object class. However I can not seem to on the subject on adding a movieclip instance name and its property to a class that could store the data, or the reasonable command to select/omit other movieclips

View 9 Replies

ActionScript 3.0 :: Using Same Class For Duplicate Movieclips

Mar 24, 2011

I have created an external class for a particular movieclip and I would like to link a duplicated version of this movieclip to the same class file.
 
Problem is I can't seem to do it. Even if I state the class as the BASE class of the new movieclip and create another random class name for it.

Is there a way I can get around this so I can assign my duplicated clip the same class name ??

View 9 Replies

Referencing Other Movieclips Within Actionscript Class

Jan 17, 2010

I have externalized the actionscript code of a movieclip into a separate class files.This movieclip requires references to some other clips on the stage. What I am currently doing to reference those clips is by using Movieclip(this.parent).otherclip but somehow that feels wrong.Is there a better way to pass in the required references into a class extending from Movieclip inside of the constructor? Or what is the recommended pattern here?

View 2 Replies

ActionScript 3.0 :: Targeting MovieClips From A Class?

Mar 3, 2010

how to target MovieClips from a class. If I have a MovieClip on the stage named recMc and I want to manipulate it using a class, I know that if I attach my class in the Document Class field in my .fla file and then just do something like this... it works

- class and fla are in the same folder -

Code:
package {
import flash.display.*;
import flash.events.*;

[Code]....

how to target this object without attaching the class to the Document class?

View 4 Replies

ActionScript 3.0 :: Accessing Movieclips From Class

Mar 14, 2012

I'm having a lot of trouble understanding a certain thing.I'm creating a child of a symbol in my 'main' class.[code]I have no idea how to access 'player' from a seperate class? I would like to change x and y coords from a seperate class. However when I use code like 'player.x = player.x + 2' i get the error message Line 17 1120: Access of undefined property player.I guess in the most simple words, I do not know how to access symbols or their children from a class that is not the document class.[code]Basically I just am curious as to why I can't simply access these items from another class?

View 2 Replies

ActionScript 3.0 :: Linking The Same Class To Multiple MovieClips?

Jul 12, 2009

I just want different-looking movieclips to move in the same way so that I will only have to edit one file if I want to change their behavior, instead of copying the class file and renaming each one, and then I would have to edit the builder function name and class name inside each one as well, even though it would do the same thing.

View 2 Replies

ActionScript 3.0 :: How To Make Movieclips And Class Files

Sep 30, 2009

How would you go about accessing a movieclip inside another movieclip using a class file?ould you have to export every single part of a movieclip? Can it be done by just exporting the main movieclip?

View 2 Replies

ActionScript 3.0 :: Movieclips Fading Out Using Tween Class?

Jun 2, 2010

I've just started on my first AS3 project and have already run into a problem. Can someone please tell me why the following code is not working correctly. What's NOT happening is that the mc that is passed to the scalethis function is NOT alpha'ing to 0 and I can't for the life of me understand why.

PHP Code:
package
{

[code]....

View 7 Replies

ActionScript 3.0 :: Class To Load Movieclips To Stage?

May 31, 2011

I would really like a class that i can use to load all my movieclips from.I have 100's of external swfs - and i want to load them to stage from one class - as they are requested.I did manage to do it one way, to get access to the stage i did this:

Actionscript Code:
private var _stage:Stage;

and in the constructor code, just did:[code]...........

how to actually load the swfs, what i'm really looking for is a way to use addChild to the stage from within my class.

View 8 Replies

ActionScript 3.0 :: Accessing MovieClips That Have Been Created In A Different Class?

Dec 15, 2009

I am able to dynamically create an object on the stage with a function, but I am at a loss for how to access and manipulate the properties of that object from my Main Class.

in my Main Class I have:

ActionScript Code:
NLP_addChild.addObject(stage)
// NLP_addChild is the other class  addObject() is the function

in NLP_addChild Class appears the following:

ActionScript Code:
public static function addObject(stage:Stage)
{
var myCircle:MovieClip = new circle()

[code]....

myCircle displays correctly on the stage, myCircle is correctly assigned an x of 300. But myCircle x property cannot be assigned from my main class.

View 2 Replies

ActionScript 3.0 :: Load Multiple Movieclips In A Class?

Aug 16, 2011

i want to create and manage 2 movieclips inside a single class. i just wrote a simple setup for this and i ran into a problem:i create 2 movieclips and want them to be displayed on stage.but only the second movieclip is actually displayed and the first one is just not visible. when i switch the order in which the movieclips are created i see the one being created last. so i totally dont know what to do here. since i am very new to flash i might be missing out on something obvious.here is my class:

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

[code].....

View 2 Replies

Actionscript 3.0 :: Building A Timer Class For All MovieClips?

May 17, 2009

I've been coding actionscript poorly for about 5 years now. I'm actually pretty proficient at sloppy code. Well, now with the advent of AS3, I have to get everything right. So now it's all from scratch.

I have Lee Brimelow's example of the Timer class:

Code: Select all// We need to import the utils package
import flash.utils.*;
// Create a new Timer object with a delay of 500 ms
var myTimer:Timer = new Timer(500);

[Code]....

However, I have no idea how to connect this to a movieclip without re-building the thing over and over again with a new instance name inside the function. This is horribly redundant, something I got used to using setInterval, and I want to break that habit.

View 2 Replies

ActionScript 2.0 :: Creating Custom Class MovieClips

May 3, 2004

I make classes that extend movie clip, but I want to dynamicaly create instances of this class, so I really create MovieClips, but with the added features of the class. How should I create this instances? I want 'this' to be the root of this new movieclip with added features

View 4 Replies

ActionScript 2.0 :: Manipulating Class Generated Movieclips

Sep 24, 2006

I have been able to draw rudimentary shapes on the main timeline by importing this class on the main timeline (first frame) and plugging in the requisite parameters.[code]When I have created movieclips without actionscript, then attached AS 2 classes to them I can manipulate them. If there is not a way that I can manipulate AS-generated clips on the main timeline, is this doable from within the class?

View 4 Replies

ActionScript 2.0 :: Classes With Respect To A Movieclips 'As 2.0 Class'?

Nov 20, 2006

I am having some trouble with Classes with respect to a movieclips 'As 2.0 class' in the linkage settings.After an attachMovie i am expecting my Class members to exist but they are not

OK, This is what i was doing...I create a MovieClip called Class1_mc and another called Class2_mc, original eh.i then stick an instance of class2_mc INSIDE of Class1_mc, call it clipinner

ok so i assign Class1 to Class1_mc and Class2 to Class2_mc via the linkage settings.

[Code]...

View 6 Replies

ActionScript 3.0 :: Access Library MovieClips From Class

Feb 26, 2009

I'm creating a card game and I need to use graphics from the library. All the movieclips have their linkage setup. How do I access the library movieclips from a class?

View 2 Replies

ActionScript 2.0 :: Class To Hide MovieClips Until Animating In?

Mar 2, 2009

For the majority of projects that I create, I have an intro animation for all the movieclips on the stage, so that they do not just appear like HTML at once. The problem with this is that I do not animate in buttons and interactive movieclips on the main timeline (I use internal frames to animate. Frame 2 is always .onRollOver, Frame 11 is always .onRollOut, Frame 50 is movieAnimationIn, etc). This means that Frame 1 needs to have an alpha level of 0, so that no one sees the MovieClip until I fade it in with intro animation.

This is a pain in Debugging/IDE mode, if I need to edit the movieclip, since I have to find the little white dot (transform starting point) and double click it to view inside the movieclip from the stage. I try to create intro animation last since it usually hides all the movieclips and makes editing them annoying!

Is there a framework/class/package available that would hide all the movieclips I place in an array in the first frame of the movie and then show them once I choose to fade it in? I think I could write one myself, but I didn't want to re-invent the wheel.

This would be a greatly increase productivity to many Flash Developers.

View 3 Replies

ActionScript 3.0 :: Linkage And Inheritance - Movieclips Set To The Corresponding Class?

Jun 4, 2009

I'm creating an isometric game in AS3, Flash CS4.I created a file named Units.as which contains the following:

Code:
package
{
import flash.display.MovieClip;[code]....

The postoffice and cornershop movieclips have been set to the corresponding class names above.The file is in the same folder as the .fla and can be seen in the project window.When I compile, it doesn't include the Units.as file. Even if it just contains:

Code:
package
{
import flash.display.MovieClip;[code]....

if i create a class from the project window and select the movieclip in the library, it does include that file.So I'm assuming the compiler only includes .as files with filenames corresponding to class names.

View 2 Replies

ActionScript 2.0 :: Creating Custom Class MovieClips?

May 3, 2004

I make classes that extend movie clip, but I want to dynamicaly create instances of this class, create MovieClips, but with the added features of the class. How should I create this instances?

View 4 Replies

ActionScript 3.0 :: Adding Movieclips Dynamically Onto From A Class Stage

Aug 15, 2009

ok. so here's the thing..i have a class from where i created an array with the time, name, and position of each movieclip data.. and wanted it to go through each one and execute at a certain time.. So i tried something like this:

[Code]...

the first part works well.. but its when i try and add it to the stage that i get confused.. i tried something but i think its wrong.. can anyone help me? Basicly i want flash to get the array.. use index 1 for the name.. index 2 for the x position and index 3 for the y position.. but all this name referencing in as3 really confuses me.

View 7 Replies

ActionScript 3.0 :: Use Tween Class To Apply Filters To MovieClips?

Jul 24, 2009

How can I use the Tween class to apply filters to movieClips?
 
i want to apply a DropShadow through a tween so that it applys smoothly. Actually i want it to apply on rollover and remove itself on rollout.

View 1 Replies

Actionscript 3.0 :: Count Number Of Movieclips (in Different Class) Added

Apr 15, 2010

1) I want to count the number of movieclips(in different class) added. That is, may be I have 10 clicks, how many bigfish and smallfish are created. What function is suitable to call for doing this.

2) I have a problem on the hittest, it comes out "no hit" only but I still can see the movieclips overlap. And if I want to modify that only check whether smallfish is overlap with bigfish, what should I do? Also, there are functions inside the movieclip itself to give motion.[code]

View 1 Replies

ActionScript 3.0 :: Removing Event Listeners From Movieclips In Class

Mar 21, 2011

I'm creating a class for a game, and I'm having a problem removing event listeners from movieclips in that class.In the class file I have an enterFrame event which puts the movieclips into motion - I want to remove that event listener when the movieclip is removed from the stage.I made the function 'public' in the class file and tried to target it as follows (animal is the movieclip)animal.removeEventListener(Event.ENTER_FRAME, animal.onEnterFrameHandler)

View 2 Replies







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