ActionScript 3.0 :: Skip The Creation Of A Data Object?
May 11, 2009
I'm in the early stages of writing a rather complex app that grabs data from a database (via PHP bridge) and builds out content from it.This app is going to be a very visual timeline of sorts, with different entries of many types (images, audio, video, text, etc). Each entry type has some common properties (ID, location, date, etc), and some unique (imageURL for images, audioURL for audio, etc).When creating these objects dynamically, should I:
A) First read the data from the database, assign that data to a new object that contains *just* the data, and then pass that data object to the constructor of the visual representation of that object when instantiating the specific object of that type? Or,
B) Skip the creation of a data object, and instead pass the data property by property to the specific object class.
For instance (very roughly),
A)Code:
// receive queries data here
var newImageData:ImageData = new ImageData(imageURL, headlineText, captionText); // put data into data object
var newImageEntry:ImageEntry = newImageEntry(newImageData); // create new visual object, passing data object
B)Code:
// received queried data here
var newImageEntry:ImageEntry = new ImageEntry(imageURL, headlineText, captionText); // create new visual object directly
I won't be creating the visual representation of the object immediately, so I feel like I have no choice but to map the data to a data object first....but is there another way? Should I try to merge the two, so that an ImageEntry object can be created as the data is received, but then a separate call to that object would be required to actually create the visual representation of it when needed?In the past -- which apps quite a bit simpler -- I've simply mapped all the data during the XML parsing to dynamic objects that act only as containers for the data, which is then passed to a different object to create the visual representation of it...
I have a .fla set up right now that places ball randomly around the screen. However I would like to be able to set the coordinates of the range for the objects(particles) placement to the boundaries of a shape. I am starting with a circle for the moment, but I can't figure out how to set the range of object placement to that of an MC. I was planning on somehow calculating this out but I am stumped. Is there a better way for me to draw a shape, and somehow use a mask in as3 to define where the particles can no be placed?
I'm having problems with my usual eval methods of creating objects to read off dynamic values programmatically using concatenation. I've found the set command doesn't seem to work with objects that are dynamic....
Code: function createobject(item){ //create it and store something in it set ("_root.item"+item.stored, "data storage test for item "+item); }function checkobjects(){ for (i=1;i<5;i++){ checkit=eval("_root.item"+i); trace("_root.item"+i+".stored="+checkit); [Code] .....
Running this produces the output of... Code: _root.item1.stored=undefined _root.item2.stored=undefined _root.item3.stored=undefined _root.item4.stored=undefined
How to do this - basically I'm trying to load data, then use that to create dynamic objects and values within it, then I'm trying to work with those values by again using loops to read off the dynamic values during runtime. Obviously if these were "fixed" variables, then it would be easy, problem is that its impossible to use the new Object() command with dynamic names!
Previously I've used this: Code: checkit=eval("_root.item"+i+".stored); trace("value is "+checkit); Is it my imagination, or was this stuff a lot easier to do in AS1?
Is there another way to work with movieclip classes than attaching them from the library?For instance say that I have a textbox class that extends the movieclip class. Puts it on the scene and then I'm free to work with it from the class as I want.But inside this class I check if I need a scrollbar. If I do, then start a "sub-class" and create a scrollbar. I can have a movieclip in the library and attach it and have a new class on it. But what I want to do is write something like this
var clipScroll = createEmptyMovieClip("scrollBar", 3) clipScroll = new com.texts.text_items.ScrollBar
the problem is if I do like this the class that I start is just an object. I can't trace where it is, I cant create a movieclip inside it and trace where that is.
Hopefully you guys can see something i am missing. I want to skip the intro of the flash movie after the first visit, so the user doesn't have to see the intro to get to the main site.
I have the code below on frame 1, an intro flv on frame 2 and the main site on frame 3. Code seems perfect and straight forward, why is it not working for me. I had a stop(); on frame 2 and 3 but I removed them to see if that would fix it, but no luck.
I want to skip the intro of the flash movie after the first visit, so the user doesn't have to see the intro to get to the main site.
I have the code below on frame 1, an intro flv on frame 2 and the main site on frame 3. Code seems perfect and straight forward, why is it not working for me. I had a stop(); on frame 2 and 3 but I removed them to see if that would fix it, but no luck.
I want to skip the intro of the flash movie after the first visit, so the user doesn't have to see the intro to get to the main site.
I have the code below on frame 1, an intro flv on frame 2 and the main site on frame 3. Code seems perfect and straight forward, why is it not working for me. I had a stop(); on frame 2 and 3 but I removed them to see
I'm creating a small app to run from CD-Rom/local installation that will use multiple shared objects for data storage. To ensure proper saving without surprising the user with a permissions dialog unexpectedly, I'd like to request unlimited data storage on first time app launch - Joey Lott shows how to do this in the Actionscript Cookbook... request=mySO.flush(1024 * 500);
My question is,Can I perform this permissions request with the user a single time with a generic app SO in global fashion, so that the permissions would be set for any SOs created during the use of the product (all written to same SO directory),or do I have to request permissions for each and every SO created? Since the latter would be unacceptable from a UE standpoint, that means stuffing all app data into a single SO which doesn't seem so great from a data config perspective...
I'm using a loader for people to use to upload their own images for a background, and I want it to remember the image the next time they come to the page, so is there any way to save the loader data in a shared object? I haven't tried just using something like
I want to make a flash application in which i will load 3-4 different mp3 files of different instrumental music. After loading it I want play all files. Further I want to save or create a merged mp3, from all mp3s sound files in a single mp3 file.
Is it possible to convert different mp3 sound track in to different ByteArray and later using any other technology like PHP or C# can we merge all byteArray in a single byteArray to create a single mp3 file. So that we can listen all instrument playing in a single mp3 file.
I am building an ambitious site especially for someone new to the Flash.I want to create a fully functional Flash Forum.Only problem is I have not found 1 site with information on how to build one and the only thing I did find was something called the Flash Forum Engine. It is a 3rd party software suite that allows you to build a Flash Forum BUT! it costs 1000 Euro's or $2000.
I'm having a hard time creating a Flash using Flash 5. The first loop asks for a number of participants. The next loop, you select or enter the name of the beverages available. The third, and more complicated loop - Up to 4 randomly selected beverages are selected and a percentage (for mixing) are provided. For example;
I have a project of dynamic banner creation. The main part of the job is creating a swf on clicking on a "publish" button on stage. A certain movieclip of any width and height on stage must be exported as a new swf file.
I am considering using flash for a kiosk project together with Visual Basic. I need to create simple SWF file with some buttons and background image, and maybe play some movie clips. Could you kindly suggest free tools for that purpose.
If there are not free tools for that, what is the normal commercial enviroment use?
When you make a movie clip, and have it open, does it have a physical 'place' on your pasteboard or main timeline?
For instance, when I test my 'scene' (as opposed to movie) my clip will be out of whack and off to the side of my movie viewer.
Then when I place the clip in my main timeline, i have to monkey around with it to get it to line up. I get a circle and a blue line at the top, but not sure what that space corresponds to.
Is there a good tut out there for movie clip creation and placement? It feels really sloppy the way Im doing it.
I'm somewhat of a noob here, so please forgive my ignorance. I tried to google the answer to my questions, but probably not using the right terms.
So my questions are these: Is there any advantage to using vector elements in flash projects, or do they just get rasterized in the swf creation process?
If you use vector instead of raster art, can you scale your swf infinitely large (theoretically) without degradation? Will vector art result in a smaller swf size? Will it take less processing power to play?
I'd like to learn how to create a java web service that can be consumed by a web tier, which is constituted of java and flex. What books can help me learn how to create a java web service and consume it via java & flex?Should I look to build a web service from scratch or from frameworks like: XFire, Axis, CXF, Spring Web Services, etc.?If using a framework is recommended, which of the above or any others makes the most sense to learn/use?
EDIT:Both the java AND flex components of the web tier need to independently access the web service. For example, the flex component helps the user create & save a spreadsheet; the java component retrieves the spreadsheet data and displays it accordingly.
My goal is to make a flash/as3 program that would pull multiple sets of data (images and texts) from the database and compile and save a flash video project for each one. What might be the best way to go about making this work? I checked but wasn't able to find a function that would publish the flash project in it's current state, so I don't think I can execute the entire process in a single flash/as3 file. My only other option is to have some other program/batch file take care of the querying the database and compiling multiple flash/as3 movies by starting up a flash program and passing it the parameters of the data it needs to build 1 complete project for 1 set of data. Is there a program to create .swf files automatically? Is it even possible to pass in init params to flash/as3 project?
I am working on a game in flex, and I am trying to create an xml file for each user if it is their first use, and then after that just access that file and edit it accordingly.Is there anything that could do this same thing first off, basically create and edit some sort of save state? I assume that flex would have some kind of saving state type of thing, but I am not sure what to look for in that respect.If not, does anyone know how to do this with xml files?
My problem is i am trying to make a panel. My button in in Main.mxml whereas the panel functions are defined in panel_Create.mxml. the code works fine. In panel_Create their are functions to create panels at runtime. The problem i am facing is when i run the program it wont show the panels but it does increase the value of n and after 8 clicks it gives alert message. The code works fine when i put all the code in Main.mxml
I have Flash 2004 MX (Educational Version), and I'm trying to get an flv player for my flv in my library to work with a play button (when the vid ends, it should automatically have the code written so that it will pop back to the start (if possible). I was coached a bit that I need to use the Netstream thing (as 2004 doesn't have the mediacomponent) and so far I've put the 'New Video' object onto my stage and created my own play button. (the video also shouldn't automatically play but should be sitting there 'ready to play' until someone clicks the play button.) Also, of importance, is that I have a timeline with a loop of animation that should be able to keep looping endlessly even though this video i'm wanting to stream is longer than the looped animation, so if someone plays the video, the animation loop should still keep animating/going even as the video is played or stopped, etc. In other words, the video should have it's own timeline apart from the animation's timeline. Unfortunately, I'm a newb with code and have no idea to get the video into the object or how to have the play button work with it, etc.
I'm making a custom class from a player I created from scratch.After multi verification of the instances , and after linking correctly my movie clip player, I still get the 1120 error.It doesn't get the "Player_mc." and all the mc inside it.1120:All of this is my first flash project.
I would like to set the stage size to the size of a random jpeg after it successfully loaded. So I don't know the dimenstions beforehand. It there a way to do that without using javascript. I know there is a solution using javascript, but I don't want to use that. I know I can set the stage size by using [SWF(width = 800, height = 600)]. But that only works before you do anything else. Not after loading the jpeg.