Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Adding Preloader



can anybody help me adding preloader. i want my swf in a webpage.when its being loaded i want to show a preloader.but i dont have any idea how to do that.some where i found the following code but it dont works. all it shows is a blank screen until the swf loads.the code is in the third frame. the forth frame calls an AS file that designs my SWF. the first frame has the GIF for preloader and second frame is blank. the code in second frame is: its an AS2 code and i wnt it in AS2 itself. i dont know if this the right place to ask.but still expecting a reply. thanks in advance.Attach Codeif (this._framesloaded < _root._totalframes) { this.gotoAndPlay(1);} else { this.gotoAndStop(4);}



Adobe > ActionScript 3
Posted on: 07/23/2008 11:16:24 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Adding A Preloader
I have a large flash file (1.8 mb) and it takes approx. 10 secs to load. How can add on an exisisting preloader to it?

Adding Preloader
this is where I get frustrated with flash. I understand the idea behind a preloader and how it works. the problem I have, is that I'll spend weeks and weeks making a complicated flash site/movie, with movies inside movies, and all kinds of effort involved, and towards the end I'll remember I need a preloader. Now I'm hosed. It would be nice if I could make a new .swf that has a frame for my preloader, then my movie shows on the next frame, but if I do this, all of my coordinates get completely skewed in the original .swf, and nothing works anymore.

Is there an easy way I can dig myself out of this hole? All the other times I've done this, the site was practice, or an idea I wanted to try, so I could throw it all away and forget about it, if I "forgot the preloader". This time its for real. A real customer with a real deadline, and I don't want to start from scratch at this point. I'm sure I'm not only one that has done this before.

Help With Adding Preloader
I am working from Guatemala and would love some support! I am trying to add preloaders to my existing photography portfolio. There are many large photos that take forever to load online! I have a preloader set up that (I believe) I can set up before each file. I am new to these, so this may not be the most effective way ( I would LOVE imput) In this method, When I copy and paste the frames from my previous functioning file into the "content" of the preloader, the thumbnails on my scroller do not function (on release) output says undefined.... Help!! I have attached a link to the flash file, if someone has the time to check it out!
snap ab.fla





























Edited: 08/15/2007 at 10:21:40 AM by StephGuatemala

Adding The Preloader?
I have all this code in the first fram eof my movie that duplicated the movie clip button on the stage and loads names into the dyn txt box from a txt file. I want to add my preloader, but now I'm cofused as to where all my code goes. Do I put the preloader code then move my other code to a next 5th fram eor something?

Adding A Preloader
I know this is a simple question for some but I was wondering how I might go about adding a preloader. I have done some tutorials and all I did was add a preloader to a movie clip. I fhave a timeline that has 5 different layers, all with just 1 frame each -- because they are all movie clips -- how do I add a preloader? Do I need to make a new flash file, make the preloader and then somehow call to my flash movie that I want to see after? Basically I am just confused on how to set up the timeline...

Any help would be greatly appreciated!

Thanks in advance,
Evan

Help W/adding A Preloader
am currently using this script to run through an array:

Quote:




swfArray = new Array("images/indep/1.jpg", "images/indep/2.jpg", "images/indep/3.jpg", "images/indep/4.jpg", "images/indep/5.jpg", "images/indep/6.jpg", "images/indep/7.jpg", "images/indep/8.jpg", "images/indep/9.jpg", "images/indep/10.jpg", "images/indep/11.jpg", "images/indep/12.jpg", "images/indep/13.jpg");
this.createEmptyMovieClip("target1",2);
this.createEmptyMovieClip("target2",1);
target1.loadMovie(swfArray[0]);
activeTarget = target1;
preview = null;
count = 0;
_level5.nextButton.onRelease = function() {
if (count<swfArray.length-1) {
count++;
} else {
count = 0;
}
preview = activeTarget;
activeTarget = (preview!=target1) ? target1:target2;
activeTarget.loadMovie(swfArray[count]);
activeTarget.swapDepths(preview)
alfa();
};
_level5.prevButton.onRelease = function() {
if (count>0) {
count--;
} else {
count = swfArray.length-1
}
preview = activeTarget;
activeTarget = (preview!=target1) ? target1:target2;
activeTarget.loadMovie(swfArray[count]);
activeTarget.swapDepths(preview)
alfa();
};
function alfa() {
import mx.transitions.Tween;
import mx.transitions.easing.*;
time=1
t1.stop();
t2.stop();
delete t1;
delete t2;
t1 = new Tween(activeTarget, "_alpha", easeIn, activeTarget._alpha, 100, time, true);
t2 = new Tween(preview, "_alpha", Strong.easeOut, preview._alpha, 100, time, true);
}




Previously i was pulling in swf files with this running the preloader:

Quote:




loaderInterval = setInterval (preloader, 10);
function preloader() {
if (_framesloaded>=_totalframes) {
gotoAndStop(2);
clearInterval(myInterval);
}
progressBar._xscale = (framesloaded/_totalframes)*100;
}




is there a way i can add my current preloader to the array script so i pull in jpgs instead of swf files?

Adding PreLoader
Do you have to do anything special to the fla movie when you add a preloader?

the main scene is one frame and has a bunch of movie clips in them.

but the loader is loading at the same time the movie is playing. How do I make to loader load first and then the movie play?

Help With Adding Preloader To Existing Art?
Hi guys...

I'm a newbie to Flash, but not to graphic apps....
Anyway, my first attempt at Flash is a movie that
has 80 something layers in Scene 1....

Now , after gaining more knowledge I realise i need a preloader........I've been reading the various posts here to find out how to do a preloader, but what is the simplest way to now add one to this existing .fla file...
(I can't add 2 frames to this large .fla file.....can I ?)

I can't work it out and realise I'm a lamer.....lol
So any words of wisdom would be greatly appreciated.......tia
(btw......I'm using Flash MX)

Adding My Preloader To My Site?
I got my site designed and up. It goes, splash page, then you click on the icons for either a HTML site or a flash site. How can i add a preloader that I have to the flash site? I'm a total noob. Any tips or links or explainations would be helpful. Thanks!!

Adding Array To Preloader
Hello,I have a standared bar perloader witch im having troble adding a array to it so I can dynamicly load some images.

Preloader Script

Frame 1:
isDemo = false;
iDemoCount = 0;

Frame 2:
if (isDemo == false) {
iFileLoaded = _root.getBytesLoaded();
iFileSize = _root.getBytesTotal();
}
if (isDemo == false) {
iPercentLoaded = Math.round((iFileLoaded/iFileSize)*100);
} else {
iPercentLoaded = iDemoCount;
iDemoCount++;
}
pBar._xscale = iPercentLoaded;
sStatus = iPercentLoaded add "%";

Frame 3:
if (iPercentLoaded == 100) {
gotoAndPlay(_currentframe+1);
} else {
gotoAndPlay(_currentframe-1);
}
stop();
_root.play();


This is my image array script:

var imageArray = new Array();
imageArray.push("images/1.jpg");
imageArray.push("images/2.jpg");
imageArray.push("images/3.jpg");
imageArray.push("images/4.jpg");
imageArray.push("images/5.jpg");
imageArray.push("images/6.jpg");
imageArray.push("images/7.jpg");
imageArray.push("images/8.jpg");
imageArray.push("images/9.jpg");
imageArray.push("images/10.jpg");
imageArray.push("images/11.jpg");
this.createEmptyMovieClip("container", 0);
container._visible = true;
container._x = 0;
container._y = 123.4;
for (var n =0; n<imageArray.length; n++) {
var thisImage = container.createEmptyMovieClip("image" + n, n);
thisImage.loadMovie(imageArray[n]);
}

How Would I go about combining the two ?

Also the image gallery I set up uses a sliding nav where images get drawn in to MC's using the loadMovie() action. the images load into "container" fine but are still lagey when loading into the seperate littel MC's

take a look at what I have http://www.shmooze.ca/newnight/test2.htm

Adding A Preloader To An Empty _mc
Hi,
I want to add a preloader to play while an external swf loads and plays within an empty movieclip within my main movie. The swf does load rather quickly but on some computers it may take about 4 seconds so I just want the viewer to be aware that something is loading. but would I put the preloader insde the empty movieclip on frame 1? That doesn't make sense since there is no frame to jump to after frame 1. I would appreciate any advice. I am working with MX 2004. Thanks.

I'm Sorry, But I'm Seriously Having Issues Adding A Preloader:
I read a few tutorials, but I don't understand them too well.

I tried adding this preloader fla that someone has given me, but the movie just keeps flashing rapidly.

So, in terms of file > windows > actions, can someone tell me how to add this preloader?

Thanks.

Adding More Than One Preloader To A Movie.
hey,

professional flash sites have more than one preloader for each indivual page. im well accustommed to preloaders, but i need help in adding more than just one at the beggining that loads your whole movie.

www.retrostar.org when you click on the dates it initiates another preloader.

i really need help in doing this! ive looked everywhere, but i just can't find it.

any help is greatly appreciated.

thanks

Adding Preloader To External Swf
I have a preloader that I made very simuler to this one (Link) and its in my main movie but I want to make for my external swfs so everytime I call a swf my preloader would appear 1st to preload the swfs. Im using this action this.loadMovie("gallery.swf") im clueless on how to go about doing this so any information action ect... would be greatly apprecated.

Adding A Preloader To A Photogallery?
First of all this is a great forum and I'm a newpie here. I'm also new to Flash Mx and
trying to learn it through books and examples.

Question, Adding a preloader component to a photogallery.

In a recent thread:
http://www.kirupaforum.com/showthrea...threadid=11567
someone listed a resize question regarding images. The question was answered and part of the
code is as follows:

//reference to loadMe movieclip
lm_mc = _root.loadMe;

_global.loadImage = function(img) {
//dump old container
img_mc.removeMovieClip();
//create container for images inside loadMe movieclip
img_mc = lm_mc.createEmptyMovieClip("imageContainer", 1);
//load image movieclip
img_mc.loadMovie(img);
//check to see if image has loaded
lm_mc.onEnterFrame = function() {
if(img_mc._width > 0) {
resizeImage();
delete this.onEnterFrame;
}
}
}


Therefore, I would like to add a preloader while loading the images by using
the following preloader component.

Note: the Preloader has a target path property.

http://www.kirupa.com/developer/mx/p..._component.asp

To the best of my availablity, I have to add the preloader component
property to if(img_mc._width > 0) and also drag the component to a specific
frame, but where?

Thanks, note I'm a newpie to flash Mx, patience and details will be very
much appreciated.

Adding Two Onloads To One Preloader
I am making a flash animation/movie that is about 1.4MB in file size, there is also music that plays along with the animation, but the MP3 file is about 2.4MB, so I called up the loadSound function (streaming) in the first frame, and toggled the Sound start function when the PLAY button was pressed. The PLAY button only appears once the preloader has loaded all the frames of the flash file, but it does not wait for the MP3 to finish loading.

If the user clicks on the PLAY button before the MP3 has finished loading, it won't play the MP3.

If the user waits a few seconds for the MP3 to finish loading, the MP3 plays normally.

Is there a way to make the preloader load and/or calculate the MP3 as well as the animation?


Code:
// variable to hold the value of total frames in this movie
var loadAmount = _totalframes;
// loops until the frames loaded >= to frames in this movie
if (_framesloaded >= loadAmount) {
// when framesloaded then move play head to frame called 'start'
gotoAndPlay("start");
} else {
// otherwise do these calcualtions and display them on the scene
// to show how much of the movie has been loaded.
// variable to store the amount of bytes loaded so far
loaded = Math.round(getBytesLoaded());
// variable to store the total bytes of this movie
total = Math.round(getBytesTotal());
// calculate how much has been loaded and work that out as a percentage
percent = Math.round((loaded/total) * 100);
// labels to display on the preloader scene
bytesLoadedOutput = loaded;
bytesTotalOutput = total;
percentOutput = percent + "%";
// draw the progress bar
pb.pbBar._width = pb.pbHolder._width * (percent / 100);
// loop the preloader scene.
gotoAndPlay("loading");
}
Thanks in advance!
Highway of Life

Adding Percentage Preloader
Hey all im making a flash site its not at all close to complete but i tried to add that percentage preloader to it and when i test the movie all it does is blink?? well heres my fla if any one can help plz do

Adding Two Onloads To One Preloader
I am making a flash animation/movie that is about 1.4MB in file size, there is also music that plays along with the animation, but the MP3 file is about 2.4MB, so I called up the loadSound function (streaming) in the first frame, and toggled the Sound start function when the PLAY button was pressed. The PLAY button only appears once the preloader has loaded all the frames of the flash file, but it does not wait for the MP3 to finish loading.

If the user clicks on the PLAY button before the MP3 has finished loading, it won't play the MP3.

If the user waits a few seconds for the MP3 to finish loading, the MP3 plays normally.

Is there a way to make the preloader load and/or calculate the MP3 as well as the animation?


Code:
// variable to hold the value of total frames in this movie
var loadAmount = _totalframes;
// loops until the frames loaded >= to frames in this movie
if (_framesloaded >= loadAmount) {
// when framesloaded then move play head to frame called 'start'
gotoAndPlay("start");
} else {
// otherwise do these calcualtions and display them on the scene
// to show how much of the movie has been loaded.
// variable to store the amount of bytes loaded so far
loaded = Math.round(getBytesLoaded());
// variable to store the total bytes of this movie
total = Math.round(getBytesTotal());
// calculate how much has been loaded and work that out as a percentage
percent = Math.round((loaded/total) * 100);
// labels to display on the preloader scene
bytesLoadedOutput = loaded;
bytesTotalOutput = total;
percentOutput = percent + "%";
// draw the progress bar
pb.pbBar._width = pb.pbHolder._width * (percent / 100);
// loop the preloader scene.
gotoAndPlay("loading");
}
Thanks in advance!
Highway of Life

Adding To A PRELOADER COMPONENT
I have downloaded the preloader comment suggested in the preloader component tutorial (FlashMX/advanced)
It works fine. But what I would like to do is have some sort of movieclip occuring as well while the percentage bar runs.
I have tried to just add a movie clip, but then the main movie does not start.

I would really appreciate some help!!
Thanks!

I'm Sorry, But I'm Seriously Having Issues Adding A Preloader:
I already read this thread, so no need to direct me there.

I tried the tutorial, but my preloader image just kept flashing rapidly.
I posted and got no response, so I'm just gonna start a new thread. (i know, i know, shut up and get on with it...)

So, in terms of file > windows > actions, can someone tell me how to add a preloader that counts up from 0% to 100%?

Adding An Existing Preloader To A New Movie
I have an existing preloader that is two scenes long. How do I add this to an already existing movie that has one scene? Thanks!

Adding A Preloader (Link To A Great One)
Can someone please tell me how I can add the preloader below to my movie to make it run smoothly? When I go to it, it's really just a 35 Frame (or so) movie. How do I put it in only one Frame?

Check it out:
http://www.flashkit.com/movies/Scrip...2530/index.php

What do I do after I download the zip file and open the .FLA?

I Appreciate It!
Dan from Long Island

How Do I Go About Adding A Preloader To An Finished Movie
i finished/almost finished a movie but its goin to need a preloader. im new to flash so how would i add one and where can i find a good tutorial on preloaders at? i've seen them around and they never go about adding them to done movies.
thanks

Quiz Component. Adding A Preloader
Does anyone have experience with the quiz component? This component is in an external swf and needs a preloader. The problem is, if you add two frames to the beginning of the movie for the preloader code, it quits working. Any help would be great.

Adding A Preloader To A Movie - Flash 6
Do you have to do anything special to the fla movie when you add a preloader?

the main scene is one frame and has a bunch of movie clips in them.

but the loader is loading at the same time the movie is playing. How do I make the loader load first and then the movie play?

Adding A Preloader To A Movie - Flash 6
Do you have to do anything special to the fla movie when you add a preloader?

the main scene is one frame and has a bunch of movie clips in them.

but the loader is loading at the same time the movie is playing. How do I make the loader load first and then the movie play?

Adding Preloader To Quiz Problems
I'm using the FlashMX quiz template (style 2). It works fine when it's by itself. I've placed the quiz in scene 2 and put a preloader in scene 1. Preloader runs fine and after loading, it goes to quiz, as intended (there is a stop command on the first frame of scene 2).

Here is the problem, now the quiz won't advance past the title page on scene 1 (when one pushes the button to go to first question). After trying and trying again and again to fix the problem (use diff preloaders, put preloader and quiz in same scene, us diff AS, etc), doesn't wanna work for me. I'm kinda tired of trying. I think it has to do with the onClipEvent command, but I don't know enough to really modify the template's AS accordingly. Shouldn't this be something simple?

Here is the AS for the button and quiz question numbers (which are grouped-- see attachment). So, when you push the button, it's supposed to go to next page and update quiz question # (ie, 3/30, 4/30, 5/30); however, it just sits there and doesn't advance to next frame:


Quote:




onClipEvent (load) {
curQuest = -1;

if(_root.Options.QuestToAsk < _root._totalframes-2 && _root.Options.QuestToAsk > 0){

totQuest = "/ " + (_root.Options.QuestToAsk+1);

} else {

totQuest = "/ " + String(_root._totalframes-2);
}

function updateFrame () {
curQuest++;
}
updateFrame();
}




.

Can I please get a little help?

SWF File Size Before Adding Preloader?
Have an intro home page which is 51k. Do I need a preloader?

What is the rule of thumb. Up to how many k is a preloader considered unnecessary?

Adding A Preloader To A Finished Movie - Help Please
I have finished all my movies, but have noticed there are small gaps in between loading in new movies within my movie, so as I read in the forum about this, the best way is to add in a preloader. My file sizes are very very small, so I didn't think I'd need one, but I don't want that millisecond blank screen... So I found a generic preloader, which is a stand-alone entire movie. How do I place this into my movies, and where? For example, the first page.. It is the index page. Where do I put the preloader? And for a second example, when I use the funtion loadMovieClip and a new .swf is loaded in, where do I place the preloader fot this file? Thanks for your help!

Adding The Preloader To The Fla Movie (button)
Hello all,

I followed this tutorial :
http://www.actionscript.org/resource...der/Page1.html

and made a working sample with it.

Now I don't really know how to embed it into the button movie. I moved the movie to the 2nd frame, I added the preloader layer + 2 symbols from the sample, but it just doesn't work.

AM.fla is the button, and am+pl.fla is with the preloader, not working.

Thank you for any help

Sound Not Playing After Adding A Preloader
Ok... I am slowly trying to get all of the pieces to this flash file working...

FYI -- Major Newb!

I added this preloader to a flash file that was working..

http://www.tutorialized.com/view/tut...reloader/14517

After adding the preloader I:
I moved all content files to begin on the 5th frame.

I am using actionscript to allow people to pause, stop, and play sound.
The sound is launched with the following script and required me to right click the sound file in select linkage, export for actionscript and name the file (Sound).

Here is the sound actionscript
s = new Sound();
s.attachSound("Sound");
i=1;
function timeme (){
now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
_root["nowtime"+i] = (Number(hours)*3600)+(Number(minutes)*60)+seconds;
_root.newstarttime = _root["nowtime"+i] - _root.nowtime1;
i++;
}
s.start();
timeme();

after adding the preloader I can't seem to get the sound to work. I set the action to start on the 5th frame and many other tweaks and can't seem to get it to work. I am guessing there is a conflict between how the sound is loaded and the preloader.

Please help.

Thanks,

Scott

Adding A .fla Preloader To .flv Video For Website?
Hi guys, I've got a Flash video in .flv format, and I'm thinking about putting it up on my website...however, it's fairly long, and I'd like to attach a preloader (I already have the preloader .fla file made) so that when users go to view the page they'll at least see a progress bar of how much loaded, and they can decide if they want to wait to watch it or not.

Like I said, they're two separate files (the .fla for the preloader, and the .flv for the video). How would I go about "attaching" the preloader to the video? Is this possible? Any help would greatly be appreciated!

Adding Preloader Killed Menus
okay so i built my dinky little site and it works brillantly. fairly simple stuff (after a million posts and searches on this forum):- loading dynamic text from menus.

so across the top horizontal navigation i have 3 buttons and 3 menus (nested mc's). the data loads from the buttons just fine but the text being called from the menu is not loading. the only change from the working site to this one is that i added a preloader (completely different .swf) that loads the .swf with the menus, buttons, text, hulla girls, dancing elephants and contortionists.

anyone ever experienced this?

Problem With Adding Preloader To Game.
I have an event based game, that uses a single frame to display all graphics/controls, and loads all actionscript (from a few .as files) in the same frame.

I now needed to add a preloader to the game.
If I keep the preloader in the 1st frame, along with all other content, it only shows up for a moment when 100% of the movie is downloaded.
If I move all content (except preloader) to frame 2, _root.onLoad function doesnot find objects that are in Frame 2.
If I use another movie with a preloader, and load up my game here, the code still doesnt seem to find my objects (though i use _lockroot)

Help!!!

Adding A Preloader To An Already Designed Movie
Hi everyone! I am new to flash and have lots to learn! I made the mistake of creating my whole flash splash page movie and then realizing that I needed to add a pre-loader to the file... I was trying out a few tutorilas on making one and I did find one that said the following:

Q]if your adding this to a already made movie, move your entire movie down 1 frame which should leave a blank keyframe in frame 1. (1 frame is all that is needed for this)

But try as I might I am unable to figure out how exactly to move everything over (I have multiple layers) so that the first frame is blank for all of them. It would have been much simpler if I had done it from the start but the movie took so long I don't want to have to redo it!

any help would be very much appreciated!!! :)

Adding A Dynamic Preloader To The Kirupa Example
Hi all

This question is in reference to Claudio's - Preloader and Transition for Dynamic files, which can be found here

http://www.kirupa.com/developer/mx/p...transition.htm

I was just wondering would it be also possible to add an accurate preloaded that would tell you how much of the movie is loaded. If so then how would you implement this. I am a complete newbie to flash so any help would be most kind

thanks

w9914420

Adding A Image Folder To My Preloader
I have an image folder with thumbnails. The site i made www.lee25.com has a preloader. But it doesnt preload the images for the thumbnails as they are in an XML file. is there a way to make it so i can preload them? it would be the best. so any help muchos appreciated! thanks

Adding A Preloader To A Kirupa Tutorial
I have followed this tutorial http://www.kirupa.com/developer/mx/p...transition.htmand completed it

However I can not implement my "bar" preloader into the tutorial. I am able to make it say "loading" as the movie loads but just cant find where to put the AS for the bar preloader.


______
This is the code I am using for the bar preloader

"setProperty("bar", _xscale, (_root.getBytesLoaded()/_root.getBytesTotal())*100);
trace (_root._totalframes)"
______

This is where I tried to put my code but it doesnt seem to work

In the "content" MC (which loads the external swf)

onClipEvent (enterFrame) {
if (!loaded && this._url != _root._url) {
if (this.getBytesLoaded() == this.getBytesTotal()) {
loaded = true;
_root.transition.gotoAndPlay("opening");
}
}
}

_____

If anyone would be able to take a quick look at the tutorial and help me out that would be awesome

btw you can download the source code here http://www.kirupa.com/developer/mx/code/complete.zip

Thankyou so much

Can Anyone Help Me With Adding A Preloader For Multiple Images Please?
Hi all,

I have a portfolio site I'm working on which loads in images using one class that loads XML files and their data.

I would like to add some sort of functionality so that the page will only load once ALL images are loaded. At the moment it calls the image loading class once for each image meaning the images don't all load together.

Can anyone please help?

here is my image class...

package {

import flash.events.*;
import flash.net.*;
import flash.display.*;
import flash.utils.*;
import gs.TweenMax;
import gs.easing.*;

// begin class
public class Image extends Sprite {

// create variables
public var alphaStart:Number;
public var alphaEnd:Number;
public var xStart:Number;
public var yStart:Number;
public var xEnd:Number;
public var yEnd:Number;
public var rotationNumber;
public var bitMap;
public var imageLoader:Loader=new Loader;
public var timer;
public var imageName;
var xml:XML;

// begin constructor
public function Image(image:String)
{
// load in new XML file
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, onLoaded);

// when the xml file is loaded
function onLoaded(e:Event):void
{
xml = new XML(e.target.data);
// make variables from the data in the xml file
imageName = xml.image;
xStart = xml.xStart;
yStart = xml.yStart;
xEnd = xml.xEnd;
yEnd = xml.yEnd;
alphaEnd = xml.alphaEnd;
alphaStart = xml.alphaStart;
rotationNumber = xml.rotationNumber;
}

xmlLoader.load(new URLRequest(image+".xml"));

imageLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE, done);
imageLoader.load(new URLRequest(image+".png"));
}

// add the images to the stage once the load is complete
public function done(e:Event):void
{
bitMap = Bitmap(imageLoader.content);//get the xmlLoaders content as a bitmap
bitMap.smoothing = true;//turn on smoothing
addChild(imageLoader);

imageIn();
imageLoader.x = xStart;
imageLoader.y = yStart;
imageLoader.alpha = alphaStart;
imageLoader.rotation = rotationNumber;
}

// tween in the images
public function imageIn()
{
var myTweenEnd:TweenMax = new TweenMax(imageLoader, 2, {y:yEnd, x:xEnd,ease:Quad.easeOut}); //identical to the previous line - it just looks more object-oriented.
var myTweenAlpha:TweenMax = new TweenMax(imageLoader,1, {autoAlpha:1, ease:Expo.easeIn});
}

// tween out the images
public function imageOut() {
var myTween:TweenMax = new TweenMax(imageLoader, 2, {autoAlpha:0,ease:Expo.easeIn}); //identical to the previous line - it just looks more object-oriented
var myTweenEnd:TweenMax = new TweenMax(imageLoader, 1, {y:yStart, x:xStart,ease:Quad.easeOut}); //identical to the previous line - it just looks more object-oriented.

timer = new Timer(1000, 1);
timer.start();

timer.addEventListener(TimerEvent.TIMER_COMPLETE, removeMe);

// remove the images
function removeMe(e:TimerEvent):void
{
removeChild(imageLoader);
imageLoader = null;
}
}
}
}

and here is the main.as which calls the image class...

package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.display.MovieClip;
import flash.events.*;
import flash.net.*;
import flash.utils.*;

// begin class
public class Main extends Sprite {

//create variables
public var image;
public var back;
public var loader;
public var cigs;
public var era1952:Era1952 = new Era1952();
public var era1967:Era1967 = new Era1967();
public var eraNav:EraNav = new EraNav();
public var news;
public var pencil;
public var artwork;
public var badge;
public var portfolio;
public var resume;
public var folder:String;

// begin constructor and load the first era
public function Main()
{
defaultEra();
era1952.addEventListener(MouseEvent.CLICK, fifties);
era1967.addEventListener(MouseEvent.CLICK, sixties);
}

// load the first era (sixties)
public function defaultEra():void
{
folder = "sixties";
everythingIn();
}

// take out the old era and load the sixties era
public function sixties(evt:MouseEvent):void
{
folder = "sixties";
everythingOut();
everythingIn();
}

// take out the old era and load the fifites era
public function fifties(evt:MouseEvent):void
{
folder = "fifties";
everythingOut();
everythingIn();
}

// bring everything in for the new era
public function everythingIn():void
{
image = folder+"/background";
back = new Image(image);
addChild(back);

image = folder+"/newspaper";
news = new Image(image);
addChild(news);

image = folder+"/artwork";
artwork = new Image(image);
addChild(artwork);

image = folder+"/pencil";
pencil = new Image(image);
addChild(pencil);

image = folder+"/portfolio";
portfolio = new Image(image);
addChild(portfolio);

image = folder+"/cigs";
cigs = new Image(image);
addChild(cigs);

image = folder+"/resume";
resume = new Image(image);
addChild(resume);

image = folder+"/badge";
badge = new Image(image);
addChild(badge);

addChild(eraNav);
eraNav.x = 270;
eraNav.y = 800;
eraNav.alpha = 0.5;

eraNav.addChild(era1952);
era1952.x = 75;

eraNav.addChild(era1967);
era1967.x = 150;
}

// take everything out of the old era
public function everythingOut():void
{
back.imageOut();
pencil.imageOut();
news.imageOut();
cigs.imageOut();
portfolio.imageOut();
badge.imageOut();
resume.imageOut();artwork.imageOut();
}
}
}

thanks in advance guys, if you'd like to see what I mean please go to http://www.joegardner.co.uk/newsite/main.html

thanks!

Adding A Dynamic Preloader To The Kirupa Example
Hi all

This question is in reference to Claudio's - Preloader and Transition for Dynamic files, which can be found here

http://www.kirupa.com/developer/mx/p...transition.htm

I was just wondering would it be also possible to add an accurate preloaded that would tell you how much of the movie is loaded. If so then how would you implement this. I am a complete newbie to flash so any help would be most kind

thanks

w9914420

Adding Xml File To Current Preloader
I have a flash movie that pulls data from an xml file. The movie also contains symbols and tweens. The symbols and tweens are preloaded, using a preloader movie clip, which sits in first frame. The movie clip has the following actions attached to it:


Code:


onClipEvent (load) {
if (_parent.getBytesTotal() == _parent.getBytesLoaded()) {
quickPlay = true;
} else {
preLoad = (_parent.getBytesTotal() * 1.00); //percent to preload
}
_parent.stop();
}

onClipEvent (enterFrame) {
gotoAndStop(loadedIndicatorFrame());
if (quickPlay == true) { //quickly play the anim
if (_currentframe == _totalframes) {
_parent.play();
}
} else { //wait for the preload
if (_parent.getBytesLoaded() >= preLoad) {
_parent.play();
}
}
}



In the same frame on a separate layer, I have the code to pull in the xml data, which is:


Code:


var xmlData=new XML();
xmlData.ignoreWhite=true;
xmlData.onLoad=processXMLData;
xmlData.load("gridquotes.xml");



The preloader above only preloads the symbols, tweens and other flash data, but not the xml file. How can I get the xml to be preloaded also?

Any help would be great!

Thanks,

-B

Adding Flash 5 Preloader To Existing .swf File
I'm using Flash 5 and have created a menu to which I would like to add a preloader.

Not to sound stupid, but what are the step by step instructions to add a "Loading..." preloader movie to my existing menu?

The web site with the menu is located at http://www.davedicenso.com

P.s. I have searched the help areas at Flashkit.com and have not had much luck.

Thank you!
Jim
jim@davedicenso.com
http://www.davedicenso.com

P.P.S. If you have any comments or suggestions on kaing the site more professional, please let me know!

Adding A Preloader To An Externally Loaded File
I have several external swf files that are loaded into my movie when the user presses a button. some of them may end up being big files, so how can i add a preloader to these for confirmation the file is being loaded.
PLease help!!!!!

Adding Preloader To Dynamically Loading Images
Hi I was wondering how I add a loading bar to images taht are being Dynamically loaded, do I have to make them all .swf files or is there another way..Thanks in advance

you can see what I'm meaning on my site
Visions of them

the images take a little bit to down load even though I have them at most 40k

Adding Random Text From File To Preloader
I need to add a text field to my preloader. I want the text to be a random quote taken from a text file i will prepare (40-50 quotes). I'm fairly new to all this so detailed step by step directions would be appreciated.

Thanks

Adding External Preloader To Thumbnail Images
I made myself a nice Flash photo gallery template with dynamically loading JPEG images and thumbnails.

http://www.toprival.com/temp/flashga...o_gallery.html

I have an external preloader set up for the large images, but I was wondering how to go about adding a simple spinner preloader to the thumbnails themselves. Since each thumbnail's MC container has a different instance name, it seems like I would have to have a separate chunk of code for each thumbnail's preloader. Is there any way I can just code the thumbnail preloader once?

This is in Flash 8.

Adding A Preloader To An FLA File That Streams FLV Files
Currently I am working integrating a preloaded to a FLA file that streams a FLV with a FLVPlayback component.

http://www.3675design.com/Clients/RI.../index_R2.html

What I would like to do is to have a preloaded that checks how many bytes are loaded into the main FLA file, then if let’s say. 3MGS are preloaded, go ahead and play frame (2)

Currently I am using this code

onClipEvent (enterFrame) {
loaded = _parent._framesloaded;
if (loaded > 0 && loaded == _parent._totalframes && loading != "Done") {
_parent.gotoAndPlay(2);
loading = "Done";
}

percentDone = Math.floor((_parent.getBytesLoaded() / _parent.getBytesTotal()) * 100);
loadStatus = percentDone + "% LOADED";
//loadBar._xscale = percentDone;
}



Which works well with anything else, expect is the FLV file I am streaming.
How do I go about this?

Adding Preloader Causing Errors With Scrollbar
Hi,

I have a flash project that works well when you load the .swf directly into the html page. However, once I add a prelaoder (using the show display progress code from "Essential ActionScript 3.0" example 28-8 which I've used successfully before. I'm using one swf as a preloader and the main swf loads into it) the .swf loads with a number of errors:


Quote:




TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Scrollbar()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at international_fla::MainTimeline()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Scrollbar()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at international_fla::MainTimeline()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at international_fla::MainTimeline/initializeFlyerScrollbar()
at international_fla::MainTimeline/frame1()
http status: 0




Does anyone know what would cause a preloading swf to cause a working swf to break like this?

The scrollbar that is referenced in the error code came from this site:

http://flashrevolution.net/actionscript-3-scrollbar/

...and like I said, it works fine without the preloader. It is run by an external .as file called Scrollbar.as and these null references seem to be coming from there. Why would it suddenly be a null reference?

I'm happy to post anything that might be relevant. Thanks in advance for any advice.

Adding Preloader Graphic To Movieclip Transition
Hi Folks,

I have a Flash movie where, when you click on one of the buttons, a transition movieclip plays over the top of the currently playing movie. When the transition movieclip finishes playing, the new movieclip (for the button you pressed) is now playing in the middle of the screen instead. Confused? Here's the link to the short tutorial/example on this site:

http://www.kirupa.com/developer/mx/p...transition.htm

This script is almost perfect for what I want, except, instead of the simple "loading graphic" in the middle of the transition, I would rather have a loading graphic with a percentage indicator and "amount loaded" bar/graphic too.

Here's my attempt at trying to combine the script above with another standard preloader used in the past:

http://www.amplexus.com.au/source/AB...testloader.fla

Can somebody show me how to do this. Maybe I need to be passing global variables back in the "content" actions?

Any help is very much appreciated!

Cheers

Chris

Copyright © 2005-08 www.BigResource.com, All rights reserved