ActionScript 3.0 :: Link To A Class File From The Timeline Rather Than Using The Document Class?
Aug 21, 2009
Is there a way to link to a class file from the timeline rather than using the Document Class? (I tried using the document class but it messed up because of the nested movie clips and stuff like that... so I need another way)
View 3 Replies
Similar Posts:
Aug 18, 2009
I found myself loading a new XML file every day and so decided to create a small class that will load the xml file and return it.The class is loading the file but when i try to return it to a new xml object in the document class it doesnt load it.I think that it's something to with the return being in a nested function but i tried a few ways and non seems to work.
[DOCUMENT CLASS]
loadXML:LoadXML = new LoadXML();
myXML:XML = new XML(loadXML.loadXMLFile("gallery.xml"));[code].....
View 1 Replies
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
Feb 4, 2012
This is probably something basic, but I was wondering how you can access the document class and its children through a frame on movie clip's timeline.
I tried root.<object I am looking for> and stage.<object I am looking for> but neither seem to work.
View 2 Replies
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
Dec 30, 2008
When I set the following class as my document class it works (draws a rectangle) but when I don't set it as my document class and instead instantiate it using var myRec:simple_shape = new simple_shape(); in first frame of my timeline nothing happens no rectangle and no error either). why and how I can get it to work without setting it as my document class?
[Code]...
View 6 Replies
Dec 26, 2009
I've been working on flash CS3 for some time now and have learnt a lot in actionscript 3. However, I still have some very simple doubts which I want to clear:
1) Is the Document Class same as the Main Timeline?
2) If we type "trace(this)" in the actions panel on the main Timeline, it gives "object MainTimeline", is this what is the document class because there is nothing else as the mainTimeline Class.
3) If we type "stop()" in the main timeline, it stops the movie. Where does stop() belong, I mean, it is the method of which class?
4) Sometimes, when within a class or a movie clip, something like "root.gotoAndPlay" doesn't work while "MovieClip(root).gotoAndPlay()" works. Another example is when we try accessing a child of a movieClip by using getChildAt(i), "MC1.getchildAt(i).play()" does not work and we have to write "MovieClip(MC1.getchildAt(i)).play();
View 3 Replies
Jul 14, 2010
Is it possible to control items lying on different frames of an FLA file from its document class?
View 8 Replies
Nov 14, 2010
How do I access the timeline from the document class? I tried: trace(this.parent as MovieClip)
but I got a null object.
View 9 Replies
Apr 10, 2009
Hi! Is it good to have a document class and still some other frames in the mainTimeline with some code inside?
View 1 Replies
Jan 6, 2010
I've written a game in Flash using timeline code like this:On the main timeline:
Code:
stop();
include "includes/mySourceCode.as";
init();
Then,in mySourceCode.as I have a set of functions (including init(), of course).I know this technique of coding is frowned upon by many,but it was what I learned when I started out with Flash and it has always worked well for me. It also means I don't usually have to bother with importing classes to make most methods work as I guess they are all 'built in' to the main timeline already.
The problem I have now is that I have got the game sponsored, and the sponsor needs me to include his preloader, which is a document classfile.So I have his preloader working, and once loaded it tells the main timeline to proceed to the next frame, where I have my usual code as above - which now doesn't work.Firstly, it can't find my include files because it is now looking in the document class folder instead of the main .fla folder it usually looks in.Secondly, once I have moved my include files to the same folder as the document class, it gives me around 70 errors about undefined properties and methods, and things not being'compile time constants' whatever that means.
I am guessing that for some reason, since there is now a document class, Flash is no longer importing all the classes it usually does automatically for me - so could it be that I need to go through my whole game and figure out the class import paths for all the methods I have used? Or is there an easier way to get my code working how it was before without having to change it? If I do impoort all the right classes, should it work then or will I still face problems?
View 2 Replies
Oct 10, 2010
have a very simple question, (Bear with me I'm still quite new to as3 and some of my terminology may not be solid) I want to access a function that is within my document class when a movie clip on the timeline has played to a specific point (being the end). I have already been able to call another function from the document class at the top/root level (it is called to initialize all clips and buttons when you click on the "enter" button on the splash screen. Problem is that I cannot call another function (in the document class) from a movie clip within a movie clip on the timeline. Is there an easy way to do this? I have considered writing a separate class for the movie clip and then adding it onto the movie clip (using the property panel). I don't really want to do it this way because I am already using a base class on that movie clip and 3 others that use a set of generic functions.
View 1 Replies
Nov 21, 2010
I'm trying to hunt down some kind of class conflict I seem to be having when using TweeLite easing and found out the same code that errors in a document class works fine if I place it in the timeline. Example - this works in frame one of the timeline:
[Code]...
View 9 Replies
Mar 9, 2011
I had some code directly in the timeline that accessed/modified properties of some movie clips.
I then did the proper thing and moved the code to a Document class. I put the code that was formerly in the timeline into the document class constructor.
The issue I'm having is that if I access the movie clip properties "too soon" it reports that they are null. If I put the code in a timer event callback for half a second or so, or put an addFrameScript call with a frame of around 8 or higher, the movie clip references are valid and it all works.
So for some reason by the time the code in the timeline gets called all of the movie clip instances are valid. However, when inside of a document class constructor, they are not. I've tried using the ENTER_FRAME event callback but the movieclips still aren't ready.
The code is supposed to change some movie clip properties based on some loaderinfo parameters, so I do kind of need to set those properties before anything starts animating.
View 1 Replies
Jul 8, 2009
Is it possible to access the currentFrame of the main timeline from a document class (which extends movie clip)?
View 3 Replies
Apr 11, 2010
I have built a button in the fla timeline and need to have it fire a method in a document called gigyaSocial. the Timeline code works fine but I cant get it to recognise the method that I commented out at the bottom if this code snipit.
ActionScript Code:
import fl.controls.Button;
import com.player;
import com.gigyaSocial;
[Code]......
View 9 Replies
Mar 22, 2010
I have a document class called PlayVoiceOvers; I set voiceToPlay and frameToPlay in the public function and when the voice "v001.mp3" is done playing it jumps to frame label v2.[code]...
However the new voiceToPlay and frameToPlay don't do anything even though when the soundCompleteHandler is done it traces the correct values.can I pass variable information from the main timeline to the document class, apparently I can but I don't know why the new voice over doesn't play.
View 7 Replies
Mar 24, 2009
I have a new FLA with a variable in frame 1:
Code:
var testVar:String = "hello";
//--- my document class:
package
[Code]....
I just get null. How can I see a variable like that?
View 1 Replies
Jun 25, 2009
I have a function defined in my document class that I want to call on a framescript of a movieclip placed on a timeline. Of course, left to itself it's "undefined", and I can't figure out how to reference parent/root/document class.
View 4 Replies
Sep 28, 2009
So I have a MovieClip symbol created in the Flash IDE with a baseClass of flash.display.MovieClip and Class name of "Square". I have placed it on the timeline of my fla at frame 30 and given it an instance name of "square". How can I control that MovieClip from my DocumentClass? I have an ENTER_FRAME listener listening for the arrival of frame 30. At that time I want to simply do something to the "square" MovieClip. But I keep getting a compile-time error of "1119: Access of possibly undefined property square through a reference with static type flash.displayisplayObject.".
[Code]....
View 1 Replies
Nov 23, 2010
I am trying to find out why when I place trace(parent); in the timeline of my child swf I get [object Loader]but if i place trace(parent); in the constructor of the child swf's document lcass I get null.Why is this and how would I access the parent swf from the child document class if it shows as null?
View 2 Replies
Dec 30, 2009
Is there a way to get an instance reference to the document class to call a method of it from the stage's timeline?I see that here's a possible solution: using a singletonOther solution I though of is using stage.getChildAt( 0 ) but it's not very nice.Is there an 'official' instance reference? because the document class is obviously instantiated at startup, but is that instance accessible in any way without having to use a custom solution like the ones mentioned?
View 1 Replies
Feb 20, 2011
I have a question, I wrote the following test as a class:
package {
import flash.display.MovieClip;
import flash.display.FrameLabel;
public class FrameLabels extends MovieClip {
public function FrameLabels () {
[Code] .....
This works great in a document class, however, when I put it on frame 1 of my timeline, it crashes Flash. I have a stop action on the last frame so the playhead shouldn't be running the script over and over, is there any reason that this is crashing?
Timeline code:
var labelsList:Array = currentLabels;
for (var i:int = 0; i < currentLabels.length; i++) {
if (currentLabels[i].name == "monday") {
addFrameScript (currentLabels[i].frame-1, mondayHandler
[Code] .....
View 2 Replies
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
Nov 25, 2011
coder dudes I need help on some actionscript 3. Im trying to move a piece of code from the timeline into the document class. Here is the timeline code:
import Memory.MemoryGame;
// Add memory game
var memoryGame:MemoryGame = new MemoryGame(this, "settings.xml");
Here is my attempt at moving it into the Document class:
[Code]...
View 17 Replies
Oct 16, 2009
I have 3 functions in my main document class that I want to execute when the main timeline reaches a particular frame number. how do I do that? see the code and comments
[Code]...
View 2 Replies
Mar 20, 2010
I have a MovieClip in my library called WindowHider. The timeline for WindowHider contains a frame-by-frame animation that is made up of individual PNG images that I imported. Each of the 10 or so PNG images sits on it's own frame within WindowHider.I can successfully create an instance of WindowHider within my Document class and add it to the display list.
Question: Is it possible to access the smoothing property of the PNG images within WindowHider's timeline, from the Document class? The WindowHider class is animated and rotates, thus the pixels show and the image is jagged. I know if I could access the smoothing property it would solve the issue.
View 2 Replies
Nov 1, 2011
I'm just getting into flash and i would like to know how you run more than one as3 file from the main .fla file?
Is it possible to use more than one document class file?
View 2 Replies
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
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