ActionScript 3.0 :: Controlling Mcs On Stage With A Class?

Mar 9, 2009

I have a main ButtonClassTest class that extends the MovieClip class. Then I have a ButtonTest9 class that extends this ButtonClassTest and a ButtonTest9.fla.It works fine (click, rollover, etc) when I link a movieclip in the library of my ButtonTest9.fla to ButtonTest9 and place instances of this mc on stage (button1_mc and button2_mc). However, I'm not being able to control anything about the instances themselves, like, setting button1_mc.alpha = .5 in my ButtonTest9 class.I tried a whole bunch of things, like Stage., this., putting it into functions, not linking the mc in the library and using new ButtonTest9 instead.

View 2 Replies


Similar Posts:


Actionscript 3 :: Controlling Objects Of Another Class That Are Already On The Stage

Mar 3, 2011

Let's say that I've a button object (instance of Flip) and a coin object (instance of Coin) on the stage. The coin object has two frames: one showing Heads and one for Tails.

MyCoin class is as following:

package
{
import flash.display.MovieClip;
public class Coin extends MovieClip

[Code]....

Problem: How do I reach the coin object on the screen via onMouseClick function? Let's say that the object on the stage has instance name of myCoin. I suppose that had I not done this with an external class and simply used actions from the frame I could just use the instance name as a variable. I couldn't figure to do the same it in an external class. Do I first create the object which is already on the stage?

View 1 Replies

ActionScript 3.0 :: Class Can Add The Rectangle To The Root Stage Without Requireing The Instantiated Class To Be Added To The Stage?

May 3, 2010

I have a class called shapeC that only creates a rectangle and then addChild(rectangle);.  That class is instantiated on the main timeline.  Currently, the only way you can see that rectangle is to add the instantiated class to the stage via addChild(shapeC);.  My question is, is there a way that the shapeC class can add the rectangle to the root stage without requireing the instantiated class to be added to the stage?

View 4 Replies

ActionScript 3.0 :: Controlling MC's On Stage From Within Other MC's

Feb 22, 2011

I am trying to control a movieclip's visibility on the main stage from within another movieclip. I have read many forums and tried pretty much everything without any success.

Here is an example: I have two movieclips on the mainstage. one called: animate_mc another called: info_mc

Inside animate_mc, I have a button & a function that when pressed should hide the info_mc. I have tried: this.parent.info_mc.visible = false; stage.info_mc.visible = false; (_)root.info_mc.visible = false; To name a few of many other possibilities I have tried, but I still have not managed to make it work.

View 8 Replies

ActionScript 2.0 :: Controlling Stage.width If Over 1300?

Feb 14, 2005

I'm trying to say, "if the stage width is over 1300, then make the stage 1300. If it's less than 1300, just let it be whatever value it already is. I tried this but it doesn't work.

if Stage.width > 1300 {
Stage.width = 1300;
} else {
Stage.width = Stage.width;
}

I have a function that expands the stage width to be whatever size the browser window is, but don't want anyone with an apple cinema display or something comparable to have the stage that wide.

View 4 Replies

ActionScript 2.0 :: Controlling Stage.width If Over 1300

Feb 14, 2005

I'm trying to say, "if the stage width is over 1300, then make the stage 1300. If it's less than 1300, just let it be whatever value it already is. I tried this but it doesn't work.[code]I have a function that expands the stage width to be whatever size the browser window is, but don't want anyone with an apple cinema display or something comparable to have the stage that wide.

View 4 Replies

ActionScript 3.0 :: Controlling Class Instances?

Aug 30, 2009

I have a class the extends a movie clip with some dynamic content in it.I need 15 instances of this class so i created a for loop for that.Im using the same variable name but im just initializing it again and again.

var thumb:MovieClip = new ThumbClass();
addChild(thumb)
my probem is that i need to find a way to control them after i created them.

[code]....

View 3 Replies

ActionScript 2.0 :: Controlling 'Blur' From Within A Class?

Feb 12, 2006

I am trying to control 'blur' from within a movieclip's class. But I don't know why it doesn't do so. I can do everything from within that class (control textfield's caption names,etc) but I just can't blur it , using the BlurFilter class. Here is my short code. Is there any problem in doing this from a class? I tried the code on the movieclip directly without using classes and it worked..

Code:
import flash.filters.BlurFilter;
dynamic class txtField{
var xTip:Number = 0.3

[code]....

View 1 Replies

ActionScript 3.0 :: Controlling An Object Placed By A Class?

Jan 9, 2011

i have two movieclips on stage, one load as a class an mc with animation, the other load a button...how can i send the message, comunicate both clases to let the button start the animation?

View 4 Replies

ActionScript 3.0 :: Controlling Labelled MovieClip On Stage From A Child .as File

Jun 20, 2009

I have an FLA file with a movieclip on the stage which is labelled "blok", and a button on the stage labelled "button1". This FLA is attached to a file called main.as through the document class.

In the same folder where I am storing main.as I have a second .as file called secondFile.as. I have imported this class into main.as using: import com.tests.secondFile;

and in the constructor of main.as I have put:

loadB=new secondFile(button1);
addChild(loadB);

Within secondFile.as my constructor looks like this:

public function secondFile(button1:SimpleButton){
button1=button1;
button1.addEventListener(MouseEvent.MOUSE_DOWN, buttonPushed);
}

[Code]....

Basically I'm trying to get the MovieClip labelled "blok" to move by 50 pixels on the stage when button1 is pressed, but when I test my FLA I get the following error:

1119: Access of possibly undefined property blok through a reference with static type flash.displayisplayObjectContainer.

I would have thought that this.parent.blok would control my movieclip labelled blok on the stage of my FLA from within secondFile.as since secondFile.as is a child of main.as which is the document class of my FLA, but obviously this is not right.

how to access labelled items on the stage from within a child object.

View 6 Replies

ActionScript 2.0 :: Code Optimization - Controlling MovieClips Buttons On Stage

Jan 7, 2007

I am sure that this code can be optimized so I don't have to type 8 instances (only 2 shown) of the (almost) same code.

kabinet.onRollOver = function() {
this.fleka._alpha = 70;
this.izlaz=false;
} kabinet.onRollOut = function() {
this.izlaz=true;
[Code] .....

What I am aiming for is to have a way to pass "kabinet", or "operativni" etc. to a function or smth... The code is used to control mc buttons on the stage. It works, but it's ugly and not practical, obviously. I tried with
[var]onRollOver = function() {
Inside a function, var being the parameter of said function ("kabinet", "operativni" etc.), but to no avail. Also tried with the with(var), thingy, but with the same result.

View 3 Replies

ActionScript 3.0 :: Controlling Sound From A Separate Class

Apr 7, 2009

Is it possible to start and stop a sound file from a separate class? In the first class, "House", I have called the MP3 using the following:

[Code]....

View 1 Replies

ActionScript 3.0 :: Controlling A Movie Clip From A Class

Oct 12, 2009

so here is the thing: I have a movie clip with 12 frames (lets call him MC), each frame shows a symbol. I want to create a class that control the MC instances, (lets call that controlClass) the controlClass will have function to change the frames of the MC instance and some other stuff. last thing I tried is that you give the constructor of the controlClass the instance name of the MC and tried to do that for example: stage. + MCInstanceName + . gotoAndPlay(2); that's what I'm trying to accomplish, at least.

View 4 Replies

ActionScript 3.0 :: Controlling Sound From Separate Class?

Apr 7, 2009

Is it possible to start and stop a sound file from a separate class?In the first class, "House", I have called the MP3 using the following:

Code:
public var mySoundReq:URLRequest = new URLRequest("tune.mp3");
public var mySound:Sound = new Sound();

[code]......

View 1 Replies

ActionScript 3.0 :: Controlling Output On Stage - Change Color Of Text Externally

Feb 12, 2012

ActionScript Code:
myTextField_txt.defaultTextFormat = new TextFormat("monotype", 16, 0x0CFF00, true);
This controls the output to the stage of my fetched text. It works great, but I would VERY much like to control this externally as well. The color for example. How would I call this in a flash variable to change the color externally? Is it possible with this code?

View 2 Replies

ActionScript 3.0 :: Flash Controlling Stage Area For Mouse Trail Effect?

Feb 14, 2012

I created a 300x250 Web banner for Google with a mouse trail effect. The banner will not upload because, according to the Google tech people, the banner contains animation that goes "out of bounds." Common sense tells me that if a mouse effect is applied to a Flash banner, then it should only be occurring when a user mouses over that banner. However, I was told that the mouse effect does indeed take place outside the 300x250 banner boundaries, which is preventing the banner from being fully uploaded live.

Does anyone know how to define the stage area so that the mouse effect only occurs in this 300x250 space? Perhaps the only way to get around this is to create a 300x250 hidden button and somehow make the mouse effect occur on rollover. If that is the case, then does anyone know how to do that?

View 2 Replies

ActionScript 3.0 :: Controlling Preloader From New Class Loading Images From XML

Mar 4, 2010

I have a gallery, which loads up all its images from an XML file. So the XML gets loaded, when loaded it calls a function urlLoaded. That in turn puts uses a Thumbnail class for each image in the XML, which then gets placed in an array, so the array can be iterated through to establish X and Y pos of each image when added to the mc Photocontainer.

PHP Code:

var urlRequest:URLRequest = new URLRequest("pics.xml");
var urlLoader:URLLoader = new URLLoader();
var xml:XML;

[Code]......

I'm passing the parameter 'i' through to the tracel function as this traces when each image has finished loading. I have a preloader in the main timeline I want to control. Say there are 20 images, how do I use the info in the tracel function to control that preloader? Would it be best to pass into the Thumbnail class the xmlList.length(), so the number of total images and then from the tracel function add and control a preloader, so when image 10 is complete the tracel function would make a slider its added to stage go to half way.

View 1 Replies

Flash :: Controlling Sub-movieclips Of A Loaded SWF From A Loading Class?

Feb 4, 2012

I have a compiled swf File (lets call it "cat.swf") that is loaded via the Loader Class of my Main movie. The cat appears without problems. But inside cat.swf there are two movieclips defined (lets call em "head" and "body"), and I have ye to find a way to get control of these from my Main movie.

When I check for numChildren of the loader Object it only gives me back one (an unnamed instance), if I cast that as a Movieclip to check for deeper children it continues all the way down like a tower of turtles.

View 1 Replies

ActionScript 3.0 :: Controlling The Number Of Bounce Using Easing Class?

Feb 20, 2009

Is there a way to control the number of bounce when using Bounce.easeIn ?

View 2 Replies

ActionScript 3.0 :: Controlling MovieClip Instances Via Array In The Document Class

Jun 25, 2009

I tried to take similar code from this same forum, but I was either getting an error 1118 or an 1009 (null object reference).

Basically I have a series of movie clip instances on the stage with instance names of:

number_1
number_2
number_3

[Code]....

I tried but I kept getting an error...I think I am a little confused as to how to make it work properly.

View 4 Replies

ActionScript 3.0 :: Flash Button Class Referencing/controlling External MC?

Feb 2, 2011

I have this following class attached to some of my buttons to simply control the roll over and out states, as well as the click event. But i want to use the same class on my buttons but would like to control a movieclip outside of the button somewhere else on the stage etc.

put simply: Clicking my button 'moveLeft' will move a movieclip left let say:

[Code]...

View 2 Replies

Flash :: Get Stage.stageHeight Or Stage.stageWidth From Imported Class?

Jul 1, 2010

can you tell me a simple and clean way to pass the dimension of the stage to another class, imported in my documentclass?

View 2 Replies

IDE :: Acesssing Derived Class Children (stage Instances) From Base Class?

Jul 16, 2009

I'm slightly new to Flash CS3 + AS3 combo, so its more of a lack of practice question. My question stems from the problem described here http:[url].... . Note, its not the same problem, its a new one.The Problem ,So I have multiple library assets (which are on teh stage) and I want to assign similar functionality to all of them.

Attempt 1: So I create the n assets, create a custom class in AS3, link them to Flash CS3 and obviously enough it gives me the error that multiple assets can't be linked to the same class.Obvious enough to understand (well not completely, because from a programmers background it doesn't make sense).

Attempt 2: Same as attempt 1, but instead of linking all the assets to the same class I make the base class the same class, and let the derived class be dynamically created by Flash on compile time.So the linking works, but the problem is, in my base class I have a method which does something (say an tween) on a child of the library asset. So if the assets on the stage/library are called asset1, asset2, asset3 (same name for asset name, class name, id name), each of them has a sub-movieclip called ... say 'foo'. now if I manually wrote a class for each asset, I could do 'this.foo' to play with the sub-movieclip. However since this functionality is in the parent class, I'm unable to do it.

P.S. If you're form a programming/OOP background, its basically a abstract class problem. My Base class knows how to doSomething(), but it needs aSomething, which is defined in the Derived classes. However I found out that AS3 classes don't support virtual(C++ )/abstract (Java) in the true sense of the word (unless I missed some obvious documentation).

View 3 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 :: Stage Properties In Custom Class, Not Document Class?

Oct 14, 2011

I need to use stage.width/height in my CustomClass so I found some topics about it.

if (stage)
{
init(ar,firma,kontakt,oferta,naglowek,tekst,dane);

[code]......

View 1 Replies

Actionscript 3 :: Access A Displayobject On Stage In A Class That Is Not A Document Class?

Mar 7, 2012

How to access a display object on the stage in a class which is not a document class?

I am looking for a solution that doesn't involve passing the stage as a parameter to the class.

One solution i always come across is using "TopLevel.as". Is it a good method because as far as I have heard using global variables is not recommended because it might cause some problems while working on big projects.

View 1 Replies

ActionScript 3.0 :: Access The Stage Property From A Different Class That's Not The Principal Class?

Jul 2, 2009

I was wondering how do you access the stage property from a different class that's not the principal class tied to the fla? Essentially, I have main.as which calls another class menu.as, and I can't seem to be able to use the stage.stageWidth property from menu.as. What's the proper way to be able to use the stage property from any class? Do I have to import it separately each time?

View 2 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 :: Accessing An Object Drawn On The Stage In One Class From Another Class

Jan 6, 2011

I have created a class, call it Class1, that has various objects drawn on the stage (drawn in the IDE). It also has a function, called setColour, for changing the colour of those objects. The function works fine if I call it from within Class1.

Now I have another class, call it testClass1, that imports Class1 and calls the setColour function. First of all, none of the stage objects from Class1 are visible. Secondly, when setColour tries to modify the colour of an object, I get the error:

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

This is the code for testClass1:

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

[Code].....

So, what is the problem? Is it possible to change objects that are drawn on the stage of an imported class?

View 3 Replies

ActionScript 3.0 :: Accessing The Stage From A Class Which Isn't The Document Class?

Jul 3, 2009

I'm being really dumb today and I know this should be simple.....How do i access the stage from a class which isn't the Document Class? For instance, I want to create a tween which takes in the parameters of the stage's width? So I've written.....

ActionScript Code:
var myTweenX:Tween = new Tween(this, "x", Regular.easeOut, this.x, stage.stageWidth, 60, true);

[code].....

View 4 Replies







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