ActionScript 3.0 :: Class Based Programing Vs Timeline Programing?
Oct 29, 2010
I'm new to ActionScript 3.0, some time ago I was developing some websites using ActionScript 2.0 - mainly timeline scripting. As I want to come back to developing websites, but I don't want to go back to AS2 I'm learning AS3. On that occasion I want to learn class based programming and to learn it I'm trying to build the image portfolio website. Before, my projects build was based on main.swf file which was loading external swf files for every 'module' of the website and now I'm not entirely sure how to organize my project using AS3. So for the example let's say the website I'm building will have:- Main stage- Menu- Links content displayer- Footer Links would look like the below:- Main image gallery- Another image gallery- Contact form- About me- News module Now the question is, what is the best practice for building this kind of project?Should I create Main swf file that will load all external content as swf files (image galleries engine, contact form, about me, news module) and place it on the stage? Or should I create separate class for each of the part of the website?
My concern is, that with separate swf files, I could update just one part of the website and upload it on the server and that part was loaded when needed. With project build based on classes, after updating one link's class I'll have to compile whole project - of course it's not a big problem, but then the website will be in one file, which can grow every time I'll update the links. The swf file will contain data that may never be used so this could be easily separate swf file loaded only on request.
In actionscript you can create objects wich are somewhat like classes in C++. I've been trying to recreate the Windows class in AS... the problem is that to my knowledge an object cant be reused so to say- create as many windows as i like, all with different attributes(some based on user input). am i wrong?
I come from game programing using c++ and glut (which is an external library to display sprites and stuff). in glut you do everything in the code there is no drag and drop, this is nice since all the control is at the code itself, this is also annoying because when you want to display something you need to guess the right coordinations, this requires a few tests until you get the right coordinations.
Now in flash you do have the drag and drop feature which is great but it doesn't go well with the OOP concepts, at least for me.my dilemma is: do you create your frames (symbol creation and placement) by code only (but miss the drag and drop freature of flash) or do you create pre-made frames by drag and dropping symbols from the library?
i wanted to make a flash document , that when i try to click my mouse 1 as fast as i can on a button, it will measure how many mouse1 cliks per second,and display the mouseclicks/second in the corner , i was wondering how to do this , i am the noobiest noob at flash programming ever.
Is there a way to generate an instance of a class that implements an interface based on the name of the class?
I am trying:
var ClassReference:Object = getDefinitionByName("movement.OuterSpaceMovement") as IMovement; var m:IMovement = new ClassReference as IMovement; trace("startup..." + m);
-But I am getting an error message ReferenceError: Error #1065 (OuterSpaceMovement) not defined.
I have several classes that implement the same interface (IMovement) but I need to be able to generate new instances of these classes and then pass these instances as a datatype (IMovement datatype) to other classes...
So then I tried:
var ClassReference:Class = getDefinitionByName("OuterSpaceMovement") as Class; var m:IMovement = new ClassReference() as IMovement; and this doesn't seem to work...but the following var m:IMovement = new OuterSpaceMovement();
a countdown that is based on the timeline.For instance, there is a timeline of 30 frames. verytime the 30 frames is up I want to subtract 1 from the countdown.The trouble is I have no idea how to do this
I have a main swf which has as3 code on the timeline. I have created a new small swf (a picture gallery) using external .as files (OOP) that works well on its own. I want to load the small swf (through a button on an array) into the main swf. When I click on my button in the main swf, it does not load the small swf (or I think, it cannot read the classes formed through OOP). I get the following error message:TypeError: Error #1009: Cannot access a property or method of a null object reference. at classes::Script()TypeError: Error #1009: Cannot access a property or method of a null object reference.
I have a navigation bar, it has 4 buttons on it, home, about, photos, and contact. There is a movie corresponding to each button that will load a 100 frame animation. Home: home_MC, About: about_MC, etc. When the page loads, home_MC will be on the stage. I would like for the first 80 frames of home_MC to play, and then stop and wait until someone clicks one of the navigation buttons (home, about, etc..) and then continue playing. How to make a timeline based eventlistener, that when the event occurs will make the timeline (that is stopped) continue?
I would like to store the value from combobox or text area-MovieClip in MyClass and then I'd like to read this from another frame in *.fla file only this :) have you another code? what can I write in frame 2 Miclass and frame 3
I'm trying to make a faux 3D rotation animation where if the user mouses to the right the object rotates right and if the user mouses to the left the object rotates left. Depending on how far they move the mouse the rotation should speed up or slow down.I spent a lot of time making an object in 3d studio max and importing the animation of rotation as JPEGs onto the timeline. I figured the most efficient way to go about this would be to make the mouse control the timeline instead of the object itself.
I have a thumbs_mc with thumbnail images. Within thumbs_mc, I have a transparent overlay_mc that functions as a button. Mouse over the overlay_mc and the alpha chages so there is a tint over that particular thumbnailWhen overlay_mc is clicked, the main timeline goes to a particular frame label.What I need to do is have the position of the playhead on the main timeline also determine the alpha of the overlay_mc so the viewer knows which thumbnail is playing.
How would you go about creating a timeline animation for an iPhone or iPad application? I'm looking for something like a timeline animation in Flash. I don't need a technical explanation on how to program it, though.So here are some general questions:
- I read something about UIView for PNG sequences, but aren't these kind of animations resource intensive? And what about filesize? PNG can't be compressed like jpeg.
- What about vector-like animations? These would save a lot of kb's.
- Are there animation frameworks like TweenLite/TweenMax/Tweener/... (some well known frameworks for animations in ActionScript)?
Try to wrap my head around why sometimes a timeline base animation will run choppy in some browsers. Is it processor speed vs frame rate. I boosted my framerate to 29.97 but on older computers the animation is very arthritic.
I am thinking about using a single tulip bitmap, but want to convey that the event being publicized has tulips of every hue. I want the tulip to change colors without user intervention.
I have 3 text fields that display weather conditions from the Weather.com XML web service. The 3 text fields need to be visible only during a certain segment of the Flash Video that is set as the application's background. Do I use AS3 to specify visiblity? If so, how do I reference a certain range of frames in which the fields should be visible?
I'm trying to get the time from the server (php) and then display a different flash movie (via either a different swf or frame on timeline) accordingly.
Unfortunately I haven't found anything that relates to this using as3.
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)
I can't find a way to directly access a MC (or textfield, etc) on the timeline from a Class loaded into my Document Class. No problem from the Doc Class, but can't do it directly from the loaded Class. Is there a trick to essentiall extend the Doc Class AS from another external class?
im currently writing a piece of code where i need to get all children that are specific class or extend one.
currently im using this
ActionScript Code: public function getConnections():Vector.<NodeConnection>{ var res:Vector.<NodeConnection> = new Vector.<NodeConnection>();
[Code].....
The problem with this is that 1st, string comparison is slow, and im expecting that there will be hundreds, of instances on stage. and secondly, It is very probable that i will extend the classes that i use in the functions, so their toString() will produce different name. e.g if i have on stage instances of "Node, ExtendedNode1, ExtendedNode2 " since they are all nodes, id like to all of them be returned.
We are building an application which is using skin classes in mxml. We plan to build different variants of this application for different user segments, where most of the functionality remains same but only skins vary based on the user segment.We are adding skins to the application by the following syntax:
I'm brand new to actionscript and I've decided to try and make an overhead tile scrolling game. It's been going good so far, but here is my problem: I have the level data stored in an array, where the number represents the corresponding tile. I have movie clips in my library called "tile_1", "tile_2", "tile_3" etc. Anyway, what I was thinking of doing was this: var newTileContents:("tile_"+lvlArray[i]) = new ("tile_"+lvlArray[i])(); newTile.addChild(newTileContents); Where, if the value in the lvlArray at [i] is 2, then it will create an instance of tile_2 etc. But I am not sure how to to type the "tile_"+lvlArray[i] bit properly.
This one is going to take some setup, so bear with me,I have built an actionscript file to be used as a class library (i think that is what i would call it), it looks like this:
[Code]...
That is to say, when i press a key on the keyboard once, the loaded movie follows the mouse. But when i press the same key again, the first loaded movie stops, and the new one loaded follows the mouse. What happens. I should note that when i use and #include to call the same chunk of code, the problem vanishes.
I'm new to FLEX.I've a requirement where i do have to load the data into Class Based Model(VO) from an Employee.xml which has got employeeName,departmentName,address & projectId tags.
I am trying to build a component based on a class where when you enter a label at design time (in the properties panel), it displays on the component on the stage. This is done in all the FUI Components that have labels and I was wondering if any one knows which part of the code does this.
I have built a class based on a calendar script found here on this forum. I have modified the script to work in a class and expanded on the calendar by checking each day of the month against a database to see if there are events on that day. (if there is an event, the day movie clip goes to another frame to highlight said day)Everything works great.. at first glance. The first time the calendar loads, all the days are properly in place and the Event.ADDED_TO_STAGES runs correctly, highlighting the dates with events.
The problem occurs when the user changes the month. Everything again works the way it should except for the Event.ADDED_TO_STAGE. This event only runs for each day the first time the calendar is loaded.
I have a project which consists of 4 frames (+ one starting frame), where each frame contains a Timer class based-animation. You can visit each frame by selecting the appropriate button.
Let's say the animation in frame1 lasts for a total of 30 seconds, but I'm too impatient to watch it and decide to go frame2, which also I don't like. In the background however, the animation for frame1 is still running, for when I go to frame 2 and go back to frame1, the animation starts both from the beginning and also continues to play from where I left off.
I also get an error:
TypeError: Error #1009: Kan geen eigenschap of methode benaderen via een verwijzing naar een object dat null is. at fl.transitions::TransitionManager/saveContentAppearance() at fl.transitions::TransitionManager/set content() at fl.transitions::TransitionManager()