ActionScript 3.0 :: Preloader Approach - Internal And External Assets
Nov 5, 2009
Working on my first real project in as 3.0, trying to decide how to best work in a preloader. What I have is a single swf containing some assets, and a target to a main doc class. After loading those assets onto the stage, it runs through a routine to load several other swfs, and then 'does stuff' with them... anyway. got all that working nicely. How, now to best track the loading of the main swf? If I understand it correctly the Loader class is purely for loading external assets. well - what about internal assets?
Got this:
ActionScript Code:
//A large SWF file can monitor its download by calling
this.root.loaderInfo.addEventListener(Event.COMPLETE, func)
I think it would be called AFTER the whole main.swf has loaded. In AS2.0 i could target _level0 to get information back about the currently loading swf...
ActionScript Code:
initPercent = (_level0.getBytesLoaded()/_level0.getBytesTotal());
But, again, these are internal assets, not even living in memory yet. As far as I can tell - I need to use a preliminary (separate) swf to load the main.swf. (Like i used to do with AS2) - But if there was a method of targeting internal assets - a 'self loader' that would be cleaner...
View 5 Replies
Similar Posts:
Feb 13, 2011
I was wondering what the best way to load my flash game would be. I know how to make an external preloader, but if I want to upload the .swf of the game to a site like newgrounds, Im guessing I need an internal preloader.I've tried a few times but my game only displays after the swf is 100% loaded. While its loading I just see white screen with grey "..." which im guessing is built into the flash player.
I have a .fla called AsteroidsGame.fla which has a library of some classes, and the game's structure is coded into a .as file called AsteroidsGame.as. Maybe this is causing issues?
View 2 Replies
Dec 14, 2010
So I have spent XX hours trying to get an External Preloader to work. So I am attaching the closest thing to a finished product which is an Internal Preloader.
Can Someone please help me make it into an external one? I have tons of versions of it but I don't want to send that since they obviously don't work.
I can't seem to attach the file since it too big. You can download it here:
doubleudoubledoubleu.flashgalaxy.net/fla.zip
View 8 Replies
Nov 23, 2011
Greetings. I am working on a website that uses flash for everything. There is little HTML ... anyway, since it is such a massive main file, the client requires a preloader. I searched for some code and inserted it. It seems to be working fine. The only weirdness is, i can't get the "Loading Module" animation and the dynamic text box used to show loading status to show up on the stage. Instead what appears there is some kind of bizzarre animation that just uses little circles as an animation. Sounds crazy i know, but you can see it at the following link.
[Code]...
View 3 Replies
Nov 13, 2008
I have a Flash app that shows a map with different regions colored depending on values in an external xml file. I also have a simple preloader that I want to appear until all the elements of the app are ready to be displayed. However, when I use the preloader, the results are the same as if I hadn't use it. My map comes up immediately with no colors, there is a pause, and then the colors come in (as calculated from the data in my xml file). Do I have to have code in my xml loader that tells the user what percent of the file is loaded?
View 3 Replies
Jan 15, 2009
I'm building a simple flash webpage using as3 in order to get accustomed to it. I've got some code for a preloader which, the end result works fine,but I cannot get the preloader assets to update with the loader data.To put it simply, I cannot get the code to update my text field that would display the percent done text.It only shows at 100 when it should go 1, 2, 3, 4...etc.Also I cannot get the bar_mc (just a simple bar graphic) to scale along with the percent loaded.
Code:
function handleLoadProgress(e:ProgressEvent):void {
while (percentDone < 100) {
totalBytes = loaderInfo.bytesTotal;[code]....
View 1 Replies
Jan 27, 2010
I have a Flex application that automatically loads the SWF and it's contents and displays the default progress bar like in all Flex apps. Currently I have a class in the application using a Loader instance to load an external bitmap to be added to the stage/canvas. I'd like to handle the loading of this bitmap in the Flex default preloader and get rid of the Loader instance entirely.
View 1 Replies
Jan 26, 2010
I'm trying to change an internal AS to external AS. however i keep getting error about conflict existing in namespace internal. Can anyone help me with this? I have no idea which I'm suppose to put which var public or private.Im not very familar with AS.
[Code]...
View 3 Replies
Feb 14, 2012
im now working for a school assignment of flash game with AS3.0 which allows us to use someowever, i found that many source codes i downloaded are in external classes( XXX.as ),I want to convert it back to inner flash AS.. like:
Main.as package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
[code].....
View 2 Replies
Mar 25, 2011
Is there any way to collect all external assets (images, videos, etc) and put them in one selected folder?
View 2 Replies
Oct 1, 2009
I'm developing some elearning material to be distributed on CD. The main swf loads text, images, sounds via an XML file. protecting the assets/XML from being edited/stolen?
View 3 Replies
Feb 12, 2009
i am loading an external swf and need to access the assets within it heres my basic code:i can access fine through the onComplete function of the loader but cannot access from anywhere else....
Code:
stop();
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
[code]...
View 1 Replies
May 30, 2010
i want the code to be inside of the FLA in the actions layer but it's not working. got an error and don't know how to fix it..
[Code]...
View 4 Replies
Apr 3, 2011
str = "<mytag name='Here should have attributes from an external file'>''</ mytag> ";
doc = new XML (str);
foot_name.text = doc.firstChild.attributes.name;trace (y);
View 1 Replies
Jan 28, 2009
I understand loading external text into flash through actionscript to produce a quick way to modify text without modifying the flash movie. The problem is being able to create hyperlinks in the external text to navigate within the movie (website). So my question, Is there a way to load external text but with the ability to code links into words or phrases that point to instance names (frames) within the movie (website).
current method
create *.txt file
*.txt loads into .swf file
.swf is called from loader component on main movie.Or is this impossible and the text has to made within the main movie and edited through flash?
View 4 Replies
Nov 29, 2009
I have a nice contact form working with the code in a 2 frame movieclip.
I need to transfer the code to an external .as file.
[Code]...
View 4 Replies
Jan 11, 2012
if inside a movieclip my_mc I have onPress=function_1;
and then on the main timeline I have
attachMovie("my_mc","my_mc",1);
my_mc.onPress=function_2;
Then function_1 will not be called at all as my_mc.onPress=function_2 will screen off the internal onPress=function_1?
View 9 Replies
Mar 2, 2012
I've got a project that I've been avoiding because it's something I've never done before. I have a concept game that I put together with internal AS3. I wasn't given much time make it work, otherwise I would have done the code externally to start.
The project is now 'go', but I want to convert the crappy internal code to external. I don't have any of those fancy IDE's. I could get one, if it would help.Does anyone know of any tutorials covering internal to external conversion? Has anyone else done this? Is there a simple list of things to convert to make the code work externally?
View 1 Replies
Aug 18, 2010
I am trying to load assets from an external swf. As in:
I drew a square in flash Made it into a symbol made sure to check the "Extract for Action Script" to doubly check I created an instance of it from within the asset file. went to my loader file loaded the assets.swf tried to find the class variable using "getDefininition" FAILED.
from what I'v been seeing from around the web the following code should work. (I actually copied it word for word from one of the tutorials) but it doesn't work.
import flash.system.ApplicationDomain;
import flash.display.MovieClip;
var myLoader:Loader = new Loader();
[Code]....
there should definately be class definition for XIconG though because I tried it myself from within the Asset.swf file. also I'm not sure whether this helps you, but when I tried to debug, I looked at the event.target.applicationDomain variable from the debugger menu and under it it said domainMemory = null. I don't have a clue why that is though.
View 1 Replies
Mar 27, 2012
I am using FlashDevelop 4.0.1 RTM to create a simple Android app and I would like to ask how to include external assets (images, xml & sounds located inside the bin folder) to the apk package.
View 1 Replies
Jan 15, 2009
How do you instantiate an MC that resides in an external swf library?
So for instance loading "shape.swf" and instantiating "square_mc" from it's library onto the parent stage.
View 8 Replies
Dec 16, 2006
I use the Loader class to load external swf. And then I want to duplicate that object.What is the way to go? Is there really no easier way then senocular's duplicateDisplayObject function? Or how about just declaring a new Loader, and reloading the same path from the cache? Its a cheap way of doing it?
View 1 Replies
Oct 7, 2010
I'm creating a Flash interactive thing which is basically a couple minute animated intro and then a menu of products to choose from. You click on one of 12 products and get a little animation about how it works. So my question is where to put these 12 product animations? I was originally thinking to just put them in the main timeline and just jump to them with labels but I'm thinking that the timeline is going to get too hairy, it's already got a lot. Now I'm wondering what the best approach should be. Should I produce 12 external SWF movies to be loaded when clicked on, or should I just make each product animation an internal movie symbol and just add an instance from the library to my main timeline? Or is there any other approach that might be better for some reason?
View 5 Replies
Aug 12, 2010
When retrieving external variables from the server URLVariables my Flash get stuck on first compilation values. Whenever I update server values flash compiles the first old values. Only after i restart CS4 IDE values are updated. Is there an internal cache?
There is nothing wrong with my code, because it works fine on my mac, but not on pc.
View 1 Replies
Jul 15, 2011
I am creating a side scrolling game in Flash (as3) and trying to keep things organized and clean.Ive created a "Level" class that gets all the level data, player data, and creates all the terrain objects and the player object. Its starting to get messy because im handlng all of the functions for player collision checks and player movement, terrain movement, sound starting and stopping, enemies, and more, all in this class. Is this normal? Or is there a better way to organize things to keep them separate, but still allow them to interact with each other.
View 2 Replies
Nov 2, 2009
I'm wondering if there's a "fix" for converting a tutorial that uses an external .as file to using ActionScript internal to the Flash file itself.For example, the Colorful Explosion tutorial runs all of its ActionScript from a separate file that must be present with the swf file to run the animation.
[URL]
Is there a way to have all of the animation ActionScript run from within the swf file by, say, pasting the code into the Actions panel or other internal method? I just don't want to complicate a project with multiple files and want others to only have convenient access to a single swf file.
View 2 Replies
Jan 3, 2010
Not sure if I'm in the right place, I apologize in advance if so. I'm somewhat proficient with html, but fairly new to flash, using cs4pro, as3.Here's my dilemma. Converting an existing html/css site to flash. Flash is main site now but a few html pages are still linked, a buy page and a form page, a few others. I can get the all the external html pages to link to a frame in the flash movie, and I can get the flash to link with all external urls.My problem comes when I move to a frame outside the main timeline. The movie is lets say 393 frames. All symbols/content are on seperate layers, and so is the action. Once the full movie ends, I have several frames past that where I have basically created frames for additional "pages" and created anchors for those frames, new layes for content, new layers for anchor (labeled) and new layers for a stop(); on each frame, I extended the pertinant graphic frames out to 410 from the original movie.
Now when the movies runs the buttons appear at about frame 115, so in the action layer I coded a keyframe and then added frames of it out to frame 410 or so: I have attached the .fla (not able to attach at this forum .fla here:s say to an external link (button) like members, the html member page opens, and if you click home button, back to flash frame, and all works, all buttons, on the home frame 393. But if you go to any of the external htmls, and then go back to any other frame like frame 401 the about page, and all the rest 402 403, etc, the page appears properly, but then none of the links function.
View 1 Replies
Feb 10, 2011
I want an air application to be able to update the assets it uses, but minimizing the download needed, so only downloading files added since it last updated.I'm thinking this would include a server portion which would zip the needed files based on a version number? Has anyone implemented anything similar / got any thoughts on the best approach to building this sort of system?
View 1 Replies
Jul 24, 2009
I'm trying to write a gallery application in Flash (AS3). It uses a simple XML document to specify a series of images like this:
Code:
<Gallery name="foo">
<Image src="foo/1.jpg" />
<Image src="foo/2.jpg" />
[Code]....
I have a class which parses the XML and displays the images (which sit locally, relative to the .swf file accordiing to the 'src' properties in the XML above) in a UILoader instance. This works great until I move the .swf file somewhere else, as the images aren't part of the compiled file, and obviously it's now looking for them in the wrong place.
I understand that you can use [Embed] to embed assets into your code (this is how I include the XML document), but I can't use it to embed the images. Is there a way I can embed the images in my flash document, and address them using the src values obtained from my XML?
View 9 Replies
Aug 27, 2006
I have a Flash file that will act as a slideshow, the images change when the sound that is to be played with each image is complete (using
soundX.onSoundComplete).
I have a folder for the sounds and one for the images. I have Flash load those assets via XML. I use XML to organize the order of playing the images /sounds.
[Code]...
My question:
Is there a way to not hard-code the image/sound names in XML and instead use it to organize and pull the assets from their respected folders? My goal is to be able to have Flash and XML working as an automated process and all I have to do is add images w/their respected sound files in their folders and never have to open Flash or XML. The Flash and XML would just automatically populate the slideshow per the number of image and sound files I add.
View 2 Replies