I have my FLA with a Document Class. I also have one other class, that doesn't extend anything. am trying to pass the stage from the FLA on to my non-Document class. Obviously, the Document Class can see the main stage no problem, but having trouble passing that stage to an external class.I tried to pass it from Frame 1 in my FLA. I also tried to pass it from my Document Class to my external class, but not working like it should.Code:var passStage:TitleClass = new TitleClass(stage)Now, on to my TitleClass (non-Document class / external class)
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?
i have a movie clip which is exported for ActionScript , i want to get a variable from the document class into the movie clip class i tried this but there was an error !!
ActionScript Code: var main:Main=new Main(); main.txtScore.text="hello";
I created a movieclip with a star. Then, I creates a document class and I named it as Main.as.
In that document class I wrote: package { import flash.display.*; public class Main extends MovieClip
[Code]....
I´m not posting here all the code, but you can easily see that I´m using x_origin and y_origin variables to keep the original position of the movie clip. I will use them to move the star back to the original position.
The problem is that instead of being 20 and 30 respectively, tracing them I see that they are both ZERO. So when I drop the star, instead of going to x=20,y=30 it moves back to x=0 and y=0. I´ve to get the star position relative to stage, but I can´t find anyway!
I'm trying to create a class which will create a tween for several different instances of an object. I am creating the instances in the Document Class. The trick is, I would like to specify how long each tween will take.
As you can see, I have a variable "myTime" which syncs the timer and the tween. This causes to tween to repeat and the clouds to continually scroll across the stage. How can I determine the var myTime at the time I create each instance of the Movie Clip mcCloud?
I've got a document class (EgoGame.as) and another class (Ball.as) which has been duplicated to deal with several different video pieces. Inside the document class is a list of 'if' statements which decide which video should be played. At the moment I'm doing it the old fashioned way whereby if the condition is true....it tells the relevant Ball class to gotoAndPlay a certain frame within the linked movieclip...
I am not sure if I'm being completely stupid here, so my apologies in advance. If I have an object on the stage for example:
ball:Ball = new Ball(); addChild(ball);
it already has .x and .y values as it is placed on the stage.Then I have some value inputs, such as force, angle etc.Now when I click an event listener I want it to activate a function in Ball that will move it from the values I have just set.My question is how do I carry those values across after the ball has already been place on the stage?
When invoking super() in my subclass, I can pass uints and strings as params to super, but passing a TextField instance that is on the stage of the library instance of the subclass fails. Why? Is there a workaround?
I have a class that works with an external swf with play, pause and slider. Now that I have all that working, I'd like to be able to pass the URL of the external SWF to the class from the main fla AS. I managed to use a 'set' inside the class to retrieve the name, but it apparently doesn't trigger until after the external SWF gets loaded.
Code snippets follow: CntlClass: public var loader:Loader; private var _urlName:String; public function CntlClass() { loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, movieLoaded); loader.load(new URLRequest(_urlName)); public function set urlName(value:String):void { _urlName = value; }
Main FLA file - other than a controller (cntl_mc) containing a play button, a pause button, and a slider, the only thing in the FLA file is this code in the first frame: cntl_mc.urlName = "extswf.swf";
I am making a game project using tiles. I want to ask bout the xml.
I know how to load an xml data into the stage by using one class from library
However, rite now, I have 3 customer_mc with class for each: char1,char2,char3
And i have this xml data called customer_xml that contents the customer name,order and payment. So far i know how to call one class and do a for loop but i cant find a way to call three classes and put it into the for loop.
function init(xmlString:String):void { customer_xml = new XML(xmlString); for (var i:uint = 0; i<customer_xml.customer.length(); i++) { var customer_mc:char1= new char1();
[Code].....
how can i put three customer mc into the for loop? Do I put it in an array?
Second, I don't want it to be put randomly on the stage but only on the right corner of the stage. Is that mean, I put a precise coordinate for the customers mc?
I have those 2 function inside a class named MenuScreen.as, What I want to do is send a value true or false to another class named Game.as.If the user clicked mouse icon the value must be true and if user clicked keyboard icon it must be false.[code]
I have a custom class being constructed from my main class. In the custom class it has another custom class that is passed in as a parameter. I would like to strictly type the parameter variable but when I do, 'the type is not a compile type constant etc'.This, I understand, is because the custom class used as a parameter has not yet been constructed.It all works when I use the variable type ( * ) to type the parameter.I suspect this is a design flaw, in that I am using an incorrect design pattern.It is actually hand-me-down code, having received a large project from someone else who is not entirely familiar with oop concepts and design patterns.
I have considered using a dummy constructor for the parametered class in my main class but the passed in class also takes a custom class (itself with a parametered constructor). I am considering using ... (rest) so that the custom classes' parameters are optional.Is there any other way to control the order of construction of classes? Would the rest variables work?edit)in main.as within the constructor or another function
var parameter1:customclass2; customclass1(parameter1); in customclass1 constructor:
I am building a project where I have 15 'islands' inside one big 'ocean' movie clip. I created navigation buttons so you can explore the Ocean movie clip and look around the islands. my problem comes when i want to 'zoom into an island'
So basically on the stage i have a movie clip called- Ocean_mc, and inside it are 15 movie clips, one of them (for this example) is a movie clip called GreenIsland_mc.
when a user clicks the GreenIsland_mc it needs to expand and place itself centre stage, then when clicked again in needs to colaps back to where it came from. The problem is that when GreenIsland_mc expands it needs to expand to coordinates relative to the stage, but when I shrink it back again it need to find the original coordinates relative to its place inside the Ocean_mc movie clip.
I have a big bit of action script that I want to reuse on various frames. Rather than write it out on each frame I want to embed the script within a movie clip and embed that movie clip on each frame that it is required to be used on.
In order to do that I need to pass a different value into the movie clip.
Basically the script creates 20 pages on one frame, 40 pages on another frame and 60 on the last page.
This is the bit of code that needs to have the number fed to it:
ActionScript Code: var myArray:Array = newArray(20);
The number 20 is currently set manually. I ideally want to write this within the movie clip:
ActionScript Code: var myArray:Array = newArray(frameVal);
and on the stage I want to set the variable like this:
Frame 1:
ActionScript Code: var frameVal:Number = 20;
Frame 2:
ActionScript Code: var frameVal:Number = 40;
Frame 3:
ActionScript Code: var frameVal:Number = 60;
The movie clip that contains my code has an instance name of "testStart"
how do I get it to pass the frameVal into the movie clip?
So I've created a custom class which makes use of a Sound object. The Sound object loads a sound from a URL, and I attach and event listener to it to see it when it finishes loading i.e. Event.Complete
MY question is this: how do I receive this event outside of the class? For instance, I want to be able to create an instance of my class somewhere else, load a sound and attach an event listener to my custom class that listens for the event thrown by the sound. Understandably, I don't want to make the sound object a public variable.
I loaded a font.swf (in Flash CS5) and it works in the class I loaded the font into, but if I want to pass it to another class, how do I do that? I tried passing it as a TextFormat instance (with the format.font = my_loaded_font) but that doesn't appear to work...
if i have multiple movieclips on the stage and i am writing a document class and in document class i import another class and i need to pass these movieclips to that class.
This this not seems a difficult tusk to understand.
I can able to connect classes to each other. But the thing is that, when I am going to construct some logic to load and hold xml data and only fetch the correct child object from it, I stumped.
Here is the starter:
I connect loadXML.as to Main.fla from Properties Panel.
I have been trying to put the As3 video tutorial into a class which works fine if I keep the url of the file to play within the class. But I want to be able pass the url from the actual swf file... I have had limited success.
well, i'm getting into flash classes, and i'm working on my first project using self written classes. but i got a question about variables.i've got a MC rad_container with the class Rad linked to it. By using class instances i can now send the variable from the MC to the class, and get it returned.but i want to use the same varhere's my class Rad
Code: class Rad extends MovieClip { public var ballKleur:String;
I'm trying to pass a string from the main timeline into a variable within a class (public _myVar:String how i can acces the public variable within my class and populate it?
I have created a custom class. It seems to work (at least no errors), but when I create a button in the actual FLA that calls on the class, it doesn't change what I want it to change. Here is the class:
[Code]...
When I call for the class to make the button, it works. It also successfull calls the default.png from the class, but in the FLA the icon_retrofit.myIcon doesn't change the image to 'images/b.png'.
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).