I want to break my code into several classes for the sake of readability and reusability, but I keep getting various errors for code that works perfectly well when it's all contained in the DocClass.
Im building a project using an MVC pattern. I have (pseudo) abstract classes Model and View, each extended with particular models and views. But I cannot access properties on the extended classes of Model...Model simply distributes XML data, heres its constructor:
Code: public function Model(data:XML) { _data = data; /*_data is a protected var of type XML in Model*/ }
MainModel extends Model, and has a property called _background of type Background which also extends Model:
Code:
private var _background:Background = new Background(some XML source); public function MainModel(data:XML) {
[code]....
The problem arises when I try to pass MainModel's background property as a parameter of _bgView (highlighted in red above). The compiler says there is no background property on Model, which is true, but I need it to look at its extended class MainModel, not Model. I've typed MainView's constructor parameter with MainModel, but it is still seeing it as Model.
Im building a project using an MVC pattern. I have (pseudo) abstract classes Model and View, each extended with particular models and views. But I cannot access properties on the extended classes of Model...Model simply distributes XML data, heres its constructor:
I have an abstract class which gives specific 'base' behavior to multiple sub classes. I want to instantiate a Singleton inside this abstract class. Is it good practice to:a) instantiate a class within an abstract classb) do this with a Singleton (I know these may be frowned upon)For clarity I will give an example, the method instantiating the Singleton is:
public function createErrorRepository(repositoryType:String):void { this._errorFactory = ErrorFactory.getInstance(); this._errorRep = this._errorFactory.createErrorRepository(repositoryType);
I'm building a demo that has a keyboard in it. Obviously, people will type stuff with it and it will go into a dynamic text field. So I have a full keyboard (a movie clip named "keyboardStandard") made up of button symbols. That is placed in the same frame as the text field. Then I wrote this code, using the Q key ("keyQ"):
Code:
keyboardStandard.keyQ.addEventListener(MouseEvent.CLICK, addQ); function addQ(ev):void { enterPlayerID_txt.appendText("Q"); }
This works just fine, the Q goes into the text field. However, I sure as heck don't want to write 26 event listeners, then 26 more functions, even if it is copy paste. That's just gnarly. Plus, there are actually 3 keyboards - a numeric and special char one as well I need to handle.I seems passing a parameter from the event listener is not doable?
I am now trying to make a flash intro for my web site.I have downloaded some free templates for the same and examined them.Some special effects, means colour abstrract moving effects or explosion like effects are in that 'fla' file.They appear as movie clips. I can export them as flv also.How they are created? Is it in flash itself or from some other programs like after effects or something?I would like to create such effects for myself. If it is not in flash, then there is no point in wasting time figuring out the methods by myself.
whats the purpose of having to have an extra class such as abstract class in Flash where the methods has no implementation,but the subclasses declare those implementations.The advantage of having the methods declared in subclass than the superclass is that it would not affect the other subclasses when there are certain changes.That makes me wonder, isn't it better not to extend(inherit) empty methods but directly create a class as its own? unless there is something that the child could use from parent.Anyone could give me examples of how applicable using abstract classes/interfaces?
Can it be done in flash with some of the glow filters? Or is this probably being created in something like After Effects or Motion and then being pulled in as JPEG StillsI've looked through some tutorial sites, but most of the animation tutorials are pretty basic... and I'm not sure what to really call the effect...making searching for tutorials or forum posts a bit tricky
I apologize in advance if my question is not clear, because I don't know how to put this. What I am trying to do is to reduce few lines of repeated code by implementing various OOP methods/concepts.
The problem I have few set of of classes which has initialization process. So, I am implementing an init() method in all those classes. From the calling class (main), these objects will be instantiated and init() method of each object is called in the the order and call some other process after all of them are initialized. Something like this
does anyone know the format for setting up classes in AS? Also I was wondering if anyone knows if there is "type." A type in some programming languages is exactly like a class but its much easier to call into a program. Okay right now I just need to find out the format for classes
When I try to do this in an AS CDATA block, it tells me I can't have a class declared within a class (the MX:Application itself). Makes sense. But where and how do I do it?
i've been unsuccessfully attempting to create my own undo/redo classes that work well with any type of possible undo and redo commands.
for example, my simple class works perfectly with undoing/redoing x and y positions of display objects or undoing/redoing values of sliders, etc., but things get dicey when i try to tailor my classes to also work with things like adding and removing items to a list.
is there any well known and well documented solution for general undoing and redoing for actionscript (without Flex)?
I was wondering if anyone knew how to create a .swc library file that could be used in Flash or Flex?I want to compile a custom package of classes into a .swc for use and download,
I m new to Flash. I need to develop Flash application for mobile devices.I have created a class and using that class i created a movieclip.
I have created one more class. And whenever the enter key of the mobile device is pressed i need to create a movie clip using the second class. How to do this?
[Code]...
I dont know what's the problem? I want to remove or unload the previous movie(Which shows a piechart) and to load another movie(which shows details in a table).
How can I set up a project in Flash Builder for creating a collection of classes that is not an application by itself? When creating an Actionscript project it forces having a main application file, as well as sets up the whole bin-debug folder and such.
For instance, if you wanted to start coding something like Tweener, Papervision, or some other set of classes that doesn't publish to an application, how would you set up the project in Flash Builder?
I know global variables are supposed to be bad but is it possible to create global classes? I am creating an application and I want to have one class that handles sound. From any class I would like to be able to say soundhandler.playSound(); without having to pass references all over the place. It should just know it is there.
I have been looking all over the internet for a tutorial to which will show me how to re-create this effect on images.[url]...
I dont want to install these 3rd party components, because the project I am working on at present, may in future need to be edited by other designers/developers.
I'm still struggling with the complete concept of custom event handling within AS3. I know I am close to a complete understanding it's just not falling into place yet.[code]...
i'm trying to find something that can boost Flash display performance. I nicely ended up with WebGL, promoted by the guys behind OpenGL. I wonder if the WebGL can in any way be ported or used with actionscript 3.0. I saw someone have created plugin to use flash with Unity 3D, but it's a little complicated to manage and too little "tricky" for me. How hard could be create WebGL extensions or classes for actionscript? Any guru here that want to start doing something?
I've rarely used static variables or methods when creating external classes, but I have on occasion, and it's very useful when I need global access to a value. I've seen negative criticism on the use of the "static" keyword, but never understood why. Is there a right and wrong way of using it, or is this not true? I'd like to use it in a context similar to classes such as MouseEvent or TextFieldAutoSize, where there is a list of values globally accessible for identification purposes.
It allows better code readability, and also allows for easy customization in the future. The value of TextFieldAutoSize.NONE is "none", but as long as a programmer used the reference TextFieldAutoSize.NONE and not the string literal "none", Adobe could change the value of TextFieldAutoSize.NONE to be "hahahahaha" and everything would still work just dandy because (TextFieldAutoSize.NONE == TextFieldAutoSize.NONE) is still true even though ("none" == "hahahahaha") is not.
Is there any kind of negative impact on using static variables this way? Or even functions for that matter? I'd just like to clarify this before I go and build a large project around the idea this is perfectly okay.
I was wondering if I can create an array of created Classes. I have a feeling that I cannot, and that you can only create an array of values, not objects.
I am following these direction to the TEE to create a swc for all my custom classes but the swc never compiles. Is there another way of doing this?? [URL]