Professional :: Use More Than One Document Class File?
Nov 1, 2011I'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?
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?
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].....
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 RepliesI 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.
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 RepliesI've been working on a project in Flash CS3 for a while. To follow an object on the screen and keep it centered, I'd adjust the Document Class' x and y properties.
Yesterday I bought/installed Flash CS5 and thus Flash Player 10 was also installed. Now when I go play my SWF it seems everything is all buggy, as if the code that modifies the Document Class' x and y properties isn't exactly working properly...
I've since reopened the CS3 FLA in CS5 and converted it to a CS5 format and I can't seem to get it working the way it used to.
Did something change regarding the Document Class and how to modify the x / y properties of it in the Flash Player 10 version? I really don't know what's going on at this point.
It seems simple, but it doesn't seem to be working I have 2 as3 files as classes "mainclass.as3 (this is the document class)" and GamePlay.as3
the GamePlay class works flawlessly on it's own, but when i try to create the var to access it ... var gp:GamePlay=new GamePlay(); ... i get the following error.
I have looked at tutorial etc, but i cant get it to work i am currently getting the following error.[code]...
I'm just wondering about the difference between using an external .as file as a Document Class vs importing it via some timeline code like:
[Code]...
I can't do many simple things in AS3 that take 1 second to do in AS2,
All I want to do is attach a movieclip to the stage via a .as file that ISNT the document class.
So for examples sake lets say I have Main.swf - Main swf file with a movieclip called "PreloaderGUI". Main.as - The document class, this loads Preloader.as. Preloader.as - This preloads the movie and attaches PreloaderGUI.
I have a class called 'Main' that runs as document class but the class i only want to work on a few frames. I can't use MyClass:Classname = new Classname(); because it doesn't work the same.
What happened with it being document class is that all my game functions happened on all of the frames when i want the games functions to happen on certain frames. So my question is, how do you get a class to work the same a document class for specific frames?
Is there a way to import the class 'Main' that will work the same as document class using MyClass:Main = new Main();? Because from my knowledge that is for objects.
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 RepliesI have a FLA file that has a AS file linked via the document class.
How do I remove the link from the documnet class and the place an import on the timeline to do the same thing ?
I want to know how you access a variable within the fla file from the Document class?I want an int inside the fla or swf file to be accessed from the class that is being used to run the file?
View 5 RepliesI heard about jsfl (Flash IDE API) so I guess it is possible but I can't find any concrete example ?
View 1 RepliesIs there any way to use multiple document class inside same fla file,or change document class name dynamically i have 4-5 actionscript 3.0 file,these 4-5 files have codes of a game say level 1, level 2 ,level 3 , level 4 & 5 entirely different from each other.What i need is that when one level finishes, another level document class should be called?
View 3 RepliesInstead of posting my entire files and such, I'll make a brief example of my situation and my desired outcome.My files consist of my document class entitled Engine.as and another class Abilities.as all within the same folder.On my stage I have a MovieClip with the instance name of item1_mc. On its personal timeline I have 2 frames, one entitled "inactive" and the other "active". Here's a sample of very similar code....
Code:
package
{
import flash.display.MovieClip;
[code]....
How do I access item1_mc? In reality I have 6 different clips and I desire to access much more than frame changes...what's the overall best way to be able to interact with an item placed on the stage via an external .as file that is not the document class?
I have 2 flash files, one with an intro and the second that just has a document class file that plays out a snake game. How could i import that document flash file and make it play out on like frame 100 off my other flash file.
View 1 RepliesI am trying to use the CSVLib from [URL].. However; when trying to use one of the examples I get an "1180: Call to a possibly undefined method addFrameScript."This is what I did.Extracted the files, then moved all FLA, AS and CSV files in the root (where also the COM folder resides). Then added the import statement to the Applicaiton file and defined document class.
View 2 RepliesIs Flash a part of Captivate or do I need it to be able to put interactive quizzes into a document. It sort of sounds like Captivate 5.5 is all that I would need. My basic task is to take a PDF file and/or a MS word document and add interactive quiz questions to the document. I don't even need to record them to a database. I have been trying to learn what a bunch of these Adobe products are and what they do and don't do for over a week and finally I got some real help in this forum this morning.
View 4 RepliesI'm always having trouble with a fla.file in cs3 professional. Every time i try to reopen the file in flash i get this: failed to open document/users.desktop/jason/social.fla
View 1 RepliesI'm having an odd problem that I can't seem to resolve. I'm updating some old animations (created around 2004-2005). Most have gone without a hitch, however one file has been a problem.
First the specs: Windows 7 64bit, Master Collection CS5.5. All updated.
The problem with the file:
I can open it just fine, test the movie, etc. If I try to save the document, it fails, saying "Unable to save the document as...". I can save the file as a CS4 document, which seems to work OK. However, I need to move the contents into a new document. If I try to Copy the laters, Flash immediately crashes.
have doing my project in flash cs5.5. But then suddenly my file cannot open it.It appear like this "an error occurred opening file C:....menu.fla" and also "Flash cannot parse this document." "The following JavaScript error(s) occurred:".
View 1 RepliesUsing 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]...
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.
while working with a server side script (php or aspx) which returns some data(from the database) can we call it in a sub-class or do we have to make the calls in the document class itself?
View 2 RepliesSay i need to send some data from AS 3.0 to a server-side script for it to do some actions. Can I do this in a sub-class called some where in a document class or should we always do it in a document class?
View 1 RepliesOk, this is one of those walls that I know once I can jump over it, I will be a much happier developer again.
I've done tons of reading, and think I have a firm understanding that the general consensus is that if you want to reference something, it needs to be added to the display list, using addChild().
I hate to be defiant, but what if I don't want to?
Or at the very least, what if I want to add a movieclip class to the stage using addChild, and then reference objects inside it?
It is much easier this way than what most people recommend - adding 15 objects via addChild, then setting the x and y for the, etc.
That said, I'm all about using classes and using as3 the way it was meant to be used. So what this is, is a best practices question I guess.
HERE ARE THE STEPS I'M TRYING:
- Create new flash document
- Draw graphic symbol bg, with text field over it, select them, convert to movieclip symbol, and export class name "box", then delete it from stage
- Add document class .as file, which simply adds that class "box" from the library, to the display list using a simple addChild()
- Set a name for that box using box.name = "test" let's say
- Do a simple trace like the following - "getChildByName('test').textFieldName" - it shows up great
- So then, I'll now try to set the text by doing this - getChildByName('test').textFieldName.text = "yo";
That last line above, is what doesn't work. I know I'm referencing wrong, but how would a pro as3 developer, reference something on the stage within a movieclip class, from the document class?
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 have a custom class created by a main document class, and I want the custom class to run a function in document class after some time.
How can I sent the instruction from custom class back to the document class?[code]...
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