ActionScript 3.0 :: Creating Entire Classes Within A Package That Contains Normally In-frame Functions?
Jun 16, 2011
When I create anything in a library, it's basically a class right? Meaning I can do essentially the same thing with use of a package in an AS file? In AS 2.0 this would probably mean I can add specific functions on this class as I can do when I use flash's object interface and add script to the specific class object itself. However, in AS 3.0 you cannot attribute code directly to an object right?
This leads me to my second question. I basically want to create a flash mp3 player (I've coded this already), but make it so that it is an entire package of contents, so I can add it to my website when a mouse event is detected and then take it off the website once it's no longer needed (to conserve memory and assure an overall nice experience). The problem is that I have many objects and subsequent functions (play button, pause button, etc), and want all of this to be contained in one file. Is this even possible?
how to package entire project. I mean to say that i have large project and i want to manage all files. I have main fla file, some xml files. some .as files. right now all this in one folder. i mean to say how to say path to the main file.
This is with Flexbuilder 3.2, Eclipse 3.3.2.I am moving my development environment to a new machine. Actionscript classes that compiled in the old environment now get a compile error:
A file found in a source-path must have an externally visible definition. If a definition in the file is meant to be externally visible, please put the definition in a package.I do declare the package in these classes - I think failure to declare the package is the usual reason for this error.To add to the mystery, many classes in this project compile without errors.
I am doing an Actionscript 3.0 project which involves introspection. I am wondering if there is a way to get all the classes within a given package structure.
Let's I have a class Square that has a several functions. I want to call it from a class Grid, which is a group of Squares.So in the class file for Grid, how would I do this:
Code: public function doSquareFunction(thisFunction:Function):void{ square1.thisFunction();
I'm trying to set up an AS3 project using a single package, that will have multiple classes coded in seperate files.I am looking for examples and tutorials for this kind of project.As I understand it, these files must have the same package, and their class must be public. This will allow the multiple files and various classes to be used in the single package.[code]Either of both of these files could then be imported into the main movie and their classes / functions used in the package.
I have created the following code that pulls data from an external xml file into a datagrid. I have been trying to figure out how to get it to function using classes and/or packages. I'd like to separate the functionality into separate classes for each of the following:1) A class for loading the XML file(s) (there will likely be more datagrids and more xml files)2) A class for "drawing" the datagrid based on the xml.... others you can think of?
Code: /////////////////////////////// BEGIN xml_to_datagrid.fla ///////////////////////////////////////
I've got a movie clip which i "exported for actionscript" inside of the properties dialog.this is the code inside of the package that was created to go along with it (MovieClipName.as)[code]...
I've started using ASDoc to document my latest project. But for some reason, it will only document one package function per package. This means that it documents one function in my utils package and then skips all the others.
Has anybody here successfully documented a utils-like package, with a ton of package functions?
I am trying to set up a .as package to handle all my rollover functions for my _mc's that are acting as buttons in my fla file. Here is the code I have .
I just started using AS3 and I am not all that familiar with the new updates to the code.I keep getting this error message.1119: Access of possibly undefined property onEnterFrame through a reference with static type btnEffect.
Im learning about Classes. Simple question for you all. What is the best/standard way to organise my folder/package structure for the classes I write, in particular to placing Main.as for example. Some structures I have seen in other source code are:
I'm posting this since i just lost a half an hour with this. FlashDevelop for some reason doesn't always know code completion for classes in the fl package, to fix this add this to you Global Class path (make sure to select AS3): C:Program FilesFlashDevelopLibraryAS3frameworksFlashIDE
I have x amount of classes in a package eg. "com.trevorboyle.lotsofclasses" and I keep adding more (These classes will probably all be static and will probably all extend the same class).I wish to create a drop-down list of all these classes, preferably without having to manually create an array myself.
Once a class is selected from the list, I'll be able to use getDefinitionByName to return it, because I will know it's name at this point.The question is, as I believe there is no support in AS3 to list all the classes in a specific package, is there a design pattern that handles this?
I have been working on creating a package of reusable code for myself. I frequently create projects that have a set of panels, which I re-skin for each particular project, and each panel has its own body of functionality.There are about 10 different panels that could be used in a given project, but not each panel is used in every project. Some projects use 5, some use 8, some 10 etc. My problem is that when migrating the panels to a new project, I don't nessicarily want to have every single panel in the library with appropriate exports etc. if it's not going to be used in the project.
For example
PHP Code:
package panelPack {public class Main extends MovieClip{public function Main(){}public function activatePanel1():void{var panel1:Panel1 = new Panel1();}public function activatePanel2():void{var panel1:Panel1 = new Panel2();}public function acti
[code]...
Then I have something like a config class that would have code like this:
Then each class is something like this, referencing a library item that is exported:
PHP Code:
package panelPack {public class Panel1 extends Panel{public function Panel1(){var closeButton:SimpleButton = this.closeB;var submitButton:SiimpleButton = this.submitB;..........}}} I don't have to have panel1, panel2.....panel10 in the library if i'm only activating 1, 3, and 5!If i don't have those items in the library i get all kinds of undefined properties buttons etc. Everything that in the MC that gets exported.
I've noticed that when I instantiate a MovieClip with multiple frames (here mine has over 200, each with a vector logo) and send to a specific frame, flash player suffers very little slowdown.
I always assumed the whole mc was being loaded into memory? It is possible that my mc simply isn't big enough to cause any problems. I just wondered if anyone knew the answer?
so I'm having this problem where one of my classes can't locate a function. The function it's trying to use is in another class, so I was wondering if there was something special you had to do. This is what I'm basically doing: One class
so i've been working on a flash game for a few years now and i remember seeing a setting on a tutorial a while back where you can control how much a movie loads on each frame instance. For example the first frame of my game (loader) first shows up on 12%. I want the first frame to load on 1% and then preform the rest of the loading sequence with the first frame still visible. At the moment it isn't too bad, but once my swf file exceeds a few MB then this will cause me some issues.
Let's I have a class Square that has a several functions. I want to call it from a class Grid, which is a group of Squares.So in the class file for Grid, how would I do this:
Code: public function doSquareFunction(thisFunction:Function):void{ square1.thisFunction();
I have Flash project that is set up something like this:
myProject.fla
- document class = myMenu.as
- the document class imports a menu item from menuItem.as (import menuItem;)
I have a function in myMenu.as that sets the text formatting for all the text fields on the page. I want to be able to use this same function in menuItem.as so that all the formatting is consistent & you only have to change it in one place. How do I access this function from both myMenu.as & menuItem.as?
okay, i'm refactoring a huge ActionScript file, and so trying to move some functions into their own classes. why is this not working? i've got a function in my primary class:
// ... private var testBlock:Sprite; public function testingINT() { testBlock = new Sprite();
I'm coding a small flash game, and wan't to access different functions between classes. In C# I'm used to just making it static, but I'm having some problems with it.Here goes:
This probably has a simple solution, but I'm a complete newb to actionscript and I could really use some guidance.I have a file, called Politismos.fla. The document class of this file is: com.plaidfox.PolitismosClassPolitismosClass.as is as follows: