Preloader based on a single movie clip
Is there a way to have a pre-loader based on a single movie clip, instead of on the entire SWF size? This movie clip may have a single graphic, but the entire movie has a slideshow with more images to display...but rather than making my visitor wait for the entire site to download before they see anything, I'd like to have it so when that graphic is loaded, it displays while the rest of the movie finishes loading. And there would be a preloader that shows the progression of the single movie clip.
How can I accomplish that? Thanks for your help!
Thanks for the speedy reply, but I think I didn't explain myself well. I'm not sure your answer will help me. I have an FLA file that contains everything within it. The background image for the resulting SWF is a single JPG, contained within a movie clip with an instance name of "bg_mc". However, there are a lot of other images that also need to be loaded. So, I want the loader to show progress ONLY on the background JPG image, and when it's downloaded, the image is shown, the rest of the SWF continues to download, and when the SWF is completely loaded, the images appear. So the user is only waiting on the background image to load before they see something instead of having to wait for all images to load. Does that make sense?
Similar Messages
-
Dear all
I have a singl movie clip which has an embedded video inside.
I use the following actionscript commands to stop and play it
onClipEvent(load) {
stop();
onClipEvent(mouseDown) {
play(); }
onClipEvent(mouseUp) {
stop(); }
The problem I face is that the movie clip should play when
clicked by mouse ONLY on movie clip area which occupies only a
small part of the stage. However, when I click the mouse ANYWHERE
on the stage the movie starts to play.
Any hint? Do I need to control the coordinates of the mouse ?
Thanks
Hagopsorry, I made a mistake- i had not re-saved my files, so it
worked but not the way i thought...
my code, based on your response is attached- however it
doesnt work...
mcOther is a mc within the "child" - other.swf.
this code needs to be in the "parent" swf...
thank you. -
Movie Clip / Browser Window Resize?
Hello Everyone,
I was wondering if anyone knew of a way that you could make a
single movie clip in your .swf react to the current width of the
browser window, when its loaded.
I would like to use this specific piece of code to
dynamically center an "enter" button on a website.
Thank you in advanceIf you set the properties of your .swf to 100% width and
height your movie will automatically fill the browser regardless of
resolution. Note if your using a colored background for your web
page you will see white striping down each side of your movie. just
set the param for bgcolor to what ever you need it to be
Kevin -
How do i join multiple clips into a single movie?
I imported various video clips from my device into imovie 09. I have move all my selected parts of all the clips into my project pane. How do I join all these seperate clips in the project pane into one single movie, and then save it as such??
i have used the share menu to save the movie under quicktime. This brings two more questions:
1. Is there not a way join the clips into one movie and save it with iMovie, rather than having to share it with another application?
2. If I do share it with quicktime, can i delete the original clips from iMovie, or will that also delete the new movie in quicktime? -
Putting a preloader for a loaded .swf in a Movie Clip
I am trying to use a preloader for a larger .swf file that loads inside of a movie clip. I was wondering what code might work and where to put it. (preloader is a .swf). I am using CS4, ActionScript 1.0. Thanks.
it does nothing in that context. so use:
container._x =-258;
container._y =-235;
container.loadMovie("gallery.swf");
this.onEnterFrame=function(){
// if you have a textfield with instance name preloaderTF
preloaderTF.text=Math.round(100*container.getBytesLoaded()/container.getBytesTotal())+"% Loaded";
if(container.getBytesLoaded()>100&&container.getBytesLoaded()>=container.getBytesTotal()){
delete this.onEnterFrame; -
Preload ALL movie clips?
I am experiencing a delay or pause in the site when my first
movie of content is played ... A frew frames before the initial
animation is finished I add in :
_root.conten.gotoAndPlay("start1");
to start the home page (or the first page of my content
movie, whatever you want to call it)....
Is this a preloader problem? I just can't seem to iron it
out.
To See It:
http://www.itamidesign.com/new.html
The Code is also here:
http://www.itamidesign.com/new.fla
THANKSno no there's always a way, i was just pointing you in the
direction of the easiest way.
the first thing you need to do is check getBytesLoaded at
regular intervals rather than in a loop on a frame. this can be
achieved several ways - i've used setInterval in the example i
prepared for you.
the second thing you need to do is check that getBytesTotal
has been received from the jpg okay - this can be checked by
ensuring that getBytesTotal>4, which is the size of an empty
movie clip.
the code i have attached is independent of your xml code,
which was really confusing things, as it is unrelated to your
loader code (one problem at a time!). once you're happy with your
loader code, then you can integrate it with your working xml code.
good luck
craig -
How do I start preloader later in movie clip?
Hi,
I want a preloader to start about 20 frames in, rather than at the very beginning of a movie clip, is this possible?
The reason I dont want it to start at the beginning is because it's on an external swf which loads when a button is clicked. Becuase the swf has a transparent background at the very beginning, the preloader is showing above the main movie and it cant really be seen. The main slideshow actually starts 20 frames in so this is when I really need the preloader.
any ideas?The way I have my preloader set is on another scene so i'm not sure
how to delay it by 20 frames in the main time line? When I move the
preloader frames along by 20 it doesn't work?
This is the code I have on my preloader:
loaded_bytes = _root.getBytesLoaded();
total_bytes = _root.getBytesTotal();
loadpercent = (loaded_bytes/total_bytes)*100;
if (loadpercent != 100) {
// OPTIONAL: Place the percentage on some textfield
preloaderText.text = int(loadpercent) + '%';
// Goto respected load percentage since not done
bar.gotoAndStop(int(loadpercent));
} else {
gotoAndPlay("Main", 1);
code on next frame:
gotoAndPlay(57); -
Hi,
I built a flash photo gallery using flash and actionscript 3.
But the galleries are loading very slow.
I need help to make the pictures load faster
or to get the first picture to show before the entire
movieclip is loaded
or a script that preload the movie clips before they are
played.
I'm a beginner in actionscript, so I have no idea which
fonctions I should use and how I would use it.
I've been looking for tutorials, components all over the
week-end without success.
So please, is there anybody who can help me with this?
Here are 2 links.
The first one is where the website is visible online and the
second one is where all the files are available:
http://www.sebthiroux.com/last_online_test/
http://mmaraudeur.free.fr/liquit/
This is a very urgent matter for me as I need to make this
work for tomorrow
Thanks in advance
Sebastienthis should do it:
var snd:Sound = new Sound()
snd.onLoad = function(){
var pct:Number =
Math.round(snd.getBytesLoaded()/snd.getBytesTotal()*100);
wait = setInterval(loadingSnd, 100)
function loadingSnd(){
if(pct >= 100){
snd.start();
clearInterval(wait);
btn1.onRelease = function(){
snd.loadSound("audio/loop1.mp3", false); -
Same button on single frame to display/hide movie clip?
Hi, can a button on a single frame be coded to both display a movie clip on its first click and, after a second click, hide the movie clip? Thanks
Yes, assuming you make the movieclip invisible to start with, in the event handler function just use...
mc_name.visible = !mc_name.visible; -
Is There An Extension that Renames Layers Based on Movie Clip Names of Files
Hi all,
I was wondering if anyone knew of an extension that could
rename layers on the main time line based on the movie clip names
that are found on the time line. I have a client file that is
absolutely huge but all the layers are just named Layer followed by
random numbers.
I have seen extensions that clean up the library but never
one that cleans layer names.fcastro75,
> Sounds great! I was actually thinking about this over
the
> weekend and asking a few fellow flashers what they
though.
> I think instance names should have the highest
importance. [...]
If you're still watching this thread, I have a few more
questions for
you. :) I finally have some time to play with this script,
and there's a
twist I didn't think of earlier.
Here's how JSFL works in regard to your particular aim:
a) Get the current timeline.
b) Get the layers of that timeline.
c) Get the *frames* inside each layer.
d) Get the elements inside each frame.
The twist is C, and it adds considerable complexity to this
script. You
might have a layer with 100 frames on it, and each frame has
a different mc
(or graphic, or text field, etc.) on it. What on earth should
this layer be
named? In your previous post, you suggested this:
> Layers that have multiple instances should read
multi-item.
That may well mean that feasibly half of your layers say
"multi-item" in
then, even if a given layer only has two separate items on it
(one graphic
symbol spanned from frames 50 to 80, and another graphic
symbol spanned from
frames 200 to 550).
Even if we were to increment the names of these, you could
easily get 30
layers in a row named "multi-item (1)", "multi-item (2)",
"multi-item (3)",
and so on. Seems to me like that wouldn't be any more helpful
than what you
have now.
One approach -- much easier to program, as it happens --
would be to
simply stop at the first frame in a layer that has content at
all, and name
the layer after that.
e.g.
"instanceName" (moveiclip) [1]
... where "instanceName" is the element's instance name,
(movieclip) is the
element's type, and [1] is the occurence of that element. If
that layer
contains any additional content -- either on that frame, or
subsequent
frames, we could add that "multi-item" phrase, like this:
"instanceName" (moveiclip) [1] multi-item
This way, in cases where the designer only used on element
in a layer,
you'd get a meaningful indication of that. In cases where the
designer used
several, you'd at least get an indication of the first one,
with a hint that
others exist.
Whatcha think?
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
Single droptarget for multiple movie clips
I have a movie clip which i use as a drop target. And I have four additional movie clips which can be dragged and dropped into the droptarget movie clip. But when I place a movie clip into a droptarget and I drop the second one too, the droptarget for the second one becomes the first movie clip but not the actual droptarget movie clip.
Please suggest.Thank you for the reply. Can you give me an idea what the below code does?
mainContainer is a movie clip. mc1, mc2 are three movie clips
mainContainer.addChild( mc1 );
and while dropping mc2
mc2._droptarget - what this will refer to? -
Drop and drop 4 movie clips to single target to navigate to seperate urls
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
navigateToURL(new URLRequest(http:// websiteAdress.com));
I am trying to navigate to a new url for each movie clip, problem is im really unsure of how to achieve this I have one target on my page and would like to be able to drop any of these movie clipt o to it?
the movie clips are named:
port1_mc
port2_mc
port3_mc
port_4mc
really appreciate the helpassign a property to each movieclip that indicates the associated url. for example:
port1_mc.urlS="http://www.adobe.com";port2_mc.urlS="http://www.flash.com";
port3_mc.urlS="http://www.kglad.com";
port_4mc.urlS="http:://www.whatever.com";
you can then use:
navigateToURL(new URLRequest(e.currentTarget.urlS));
in your listener function. -
Making movie clips play in reverse in AS 3.0
Hey all. I'm changing all my files to AS 3.0 because of some
new elements I'd like to use in flash CS4.
Here:
http://www.iaw-atlanta.com/IvyLeague1-13-09.html
I have the menu navigation at the bottom with 4 buttons. When the
buttons are moused over they ascend and when they are moused out
the movie plays in reverse so that they descend. Basically in the
movie clip, I have it stopped as well as gotoAndPlay the next frame
when the button is moused over and then have a script telling it to
reverse when moused out. I know how to do this in AS 2.0 but how
can I translate the script to 3.0?DjPhantasy5,
> Ok thanks, I'll see what he also has to say as well.
Actually, NedWebs pretty much nailed it. :) The approach
you've taken
is an interesting one, because it scales all the way back to
Flash Player 5,
which didn't yet support the MovieClip.onEnterFrame event.
Without that
event, you need something like your "controller" symbol -- a
separate
looping timeline -- to perform code that depends on frame
loops.
Available as of Flash Player 6, that event would allow you
to
consolidate your code a bit by putting it all in a single
frame and avoiding
the extra movie clip symbol. That doesn't mean your approach
is wrong, by
any stretch. In fact, it's good to know your options, because
if you ever
need to publish to Flash Player 5, you'll probably do best to
use the setup
you've taken.
I'll demonstrate onEnterFrame in just a bit, in case you
want to take a
look at that.
>> there's no _root reference in AS3, but you can use a
>> MovieClip(this.parent) (which replaces what _parent
>> used to do) to locate something outside of the
immediate
>> movieclip.
The term "parent," in this context, is technically a
property of the
MovieClip class, which means all movie clips in AS3 have
access to the
"parent" feature, which points to the timeline that contains
the movie clip
in question. Buttons also feature a "parent" property. In
AS2, this
property acted exactly the same, only it was preceeded by an
underscore.
In fact, NedWebs' suggested code works the same in your
existin file.
Instead of this:
// Your existing code ...
if (_root.animation._currentframe>1) {
_root.animation.prevFrame();
this.gotoAndPlay(2)
if (_root.animation._currentframe<=1) {
this.gotoAndStop(1);
... you could be using this:
// Alternative code ...
if (_parent.animation._currentframe>1) {
_parent.animation.prevFrame();
gotoAndPlay(2)
if (_parent.animation._currentframe<=1) {
gotoAndStop(1);
... because from this scope -- that is, from this point of
view -- the
MovieClip._parent property points to the same timeline that
_root does.
That changes, of course, based on how deeply nested the
current scope is.
The term "this" in the above code is optional, because Flash
understands
what scope you're in. From the point of view of this code,
_parent is
understood to refer to the current scope's parent timeline,
just like
gotoAndPlay() is understood to refer to the current scope's
own timeline.
You could precede either of those by "this" or not.
Many people will argue that _root is probably best avoided,
only because
it's a slippery slope. It doesn't always refer to the main
timeline you
think it does, depending on whether or not your SWF is loaded
into another
SWF at runtime. Meanwhile, _parent *always* refers to the
immediately
parent timeline.
So when you look at it that way, this perfectly valid AS2:
if (_parent.animation._currentframe>1) {
... isn't much different at all from its AS3 counterpart:
if (MovieClip(parent).animation.currentFrame>1) {
It would be nicer if you didn't need to cast the parent
reference as a
movie clip here, but if you don't, AS3 doesn't realize that
the scope in
question is a movie clip.
>> You can string them along as...
>> MovieClip(this.parent.parent)
Exactly.
>> Your _currentframe in the the controller becomes
>> currentFrame. That's about it. The rest of what I
>> saw will fly as is.
Not quite. AS3 doesn't support the on() or onClipEvent()
functions, so
you won't be able to attach your code direction to the
button. Instead,
you'll have to put it in a keyframe -- which you can also do
with AS2. It's
a good idea, in any case, because it allows you to put all
your code in one
place, making it easier to find.
Here's a quick note on direct attachment:
http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent
To convert your existing FLA structure to AS3, you might,
for example,
do this:
animation.buttonMode = true;
animation.addEventListener(MouseEvent.ROLL_OUT, outHandler);
animation.addEventListener(MouseEvent.ROLL_OVER,
overHandler);
function outHandler(evt:MouseEvent):void {
controller.gotoAndPlay(2);
function overHandler(evt:MouseEvent):void {
controller.gotoAndPlay(4);
That takes care of the on(rollout) and on(rollover) code in
your current
version. The first line (buttonMode) is only necessary
because I got rid of
the button symbol and, instead, associated the event handlers
directly with
your animation clip. (Movie clips handle button-style events,
too, so you
don't need the button.) In AS3, event handling is very
straightforward:
you reference the object (here, animation), invoke its
inherited
addEventListener() method, then pass in two parameters: a)
the event to
listen for, and b) the function to perform when that event
occurs.
You can see that spelled out above. In AS2, there are quite
a few ways
to handle events, including on()/onClipEvent(), so it's
harder to know when
to use what approach. For buttons and movie clips, the
princple works the
same as I just showed, but the syntax is different.
Let's take a quick look at reducing all this code by using
the
onEnterFrame event. First, check out this AS2 version:
animation.onRollOut = outHandler;
animation.onRollOver = overHandler;
function outHandler():Void {
this.onEnterFrame = reversePlay;
function overHandler():Void {
this.onEnterFrame = null;
this.play();
function reversePlay():Void {
this.prevFrame();
All of that code would appear in frame 1. You don't need the
controller
movie clip. The animation clip no longer contains an orb
button, because
we're using animation itself as the "button". (You can always
see what
functionality any object has by looking up its class. If
you're dealing
with a movie clip, look up the MovieClip class. See the
Properties heading
to find out what characteristics the object has, see Methods
to find out
what the object can do, and see Events to find out what the
object can react
to.)
In the above code, it's all laid out pretty easily. This is
AS2,
remember. We have two events we're listening for:
MovieClip.onRollOut and
MovieClip.onRollOver. Those events are established for the
animation movie
clip by way of its instance name, and associated with
corresponding custom
functions. The outHandler() function associates yet another
function to the
MovieClip.onEnterFrame event of the animation clip. Very
simply, it
instructs animation to perform the custom reversePlay()
function every time
it encounters an onEnterFrame event. The overHandler()
function kills that
association by nulling it out, and telling animation to play,
via the
MovieClip.play() method. Finally, the reversePlay() function
simply invokes
MovieClip.prevFrame() on the animation clip.
Here's the AS3 version:
animation.buttonMode = true;
animation.addEventListener(MouseEvent.ROLL_OUT, outHandler);
animation.addEventListener(MouseEvent.ROLL_OVER,
overHandler);
function outHandler(evt:MouseEvent):void {
animation.addEventListener(Event.ENTER_FRAME, reversePlay);
function overHandler(evt:MouseEvent):void {
animation.removeEventListener(Event.ENTER_FRAME,
reversePlay);
animation.play();
function reversePlay(evt:Event):void {
evt.target.prevFrame();
It looks wordier, but if you look carefully, you'll see that
it's
essentially the same thing. The main difference is the way
scope works in
AS3. In AS2, there are numerous references to "this", because
the event
handler functions operate in the same scope as the object to
which the
association is made. In AS3, the references aren't to "this",
but rather to
the same animation clip by its *intance name*, because in
AS3, the scope
operates in the same timeline in which the code appears
(namely, in this
case, the main timeline).
In the reversePlay() function, in order to emulate a "this"
sort of
setup, I'm referring to the parameter that gets passed to all
event handler
functions in AS3. I happened to name it "evt" (for event),
but you can call
it what you like. In the case of reversePlay(), the evt
parameter refers to
an instance of the Event class, which has a target property.
The target
property refers to the object that dispatched the event --
happens to be
animation, in this case. So evt.target, in this context,
refers to
animation, which is what I invoke the MovieClip.prevFrame()
method on.
I've uploaded a handful of FLA files to my server. I won't
keep them
there forever ... maybe a couple weeks, as of this post:
http://www.quip.net/RewindTestAS3.fla
http://www.quip.net/RewindTestAS3_new.fla
http://www.quip.net/RewindTestAS2_new.fla
David Stiller
Co-author, ActionScript 3.0 Quick Reference Guide
http://tinyurl.com/2s28a5
"Luck is the residue of good design." -
Adding thousands of instances of a movie clip
I am trying to add around 20,000 instances of a single small
movie clip (HexTile) from the library into a container Sprite using
actionscript. The problem is it loads immediately and it loads very
slowly, so I would like to know if there is a way to preload it?
The class that adds the movie clip library symbol (World) is not
the document class, nor is it referenced from the document class. I
have tried dragging an empty sprite linked to World, and I have
tried exporting it to other frames as well is preloading it as it's
own .swf...any suggestions would greatly appreciated! The code
looks like:Hi
I guess you can one thing. add dummy pre-loader before loop
and then just hide it after loop ;) -
Multiple click points for one button and movie clip
I am trying to make a single button into a multiple click
point. I have a movie clip on the stage and I have an invisible
button over it. The movie clip consists of a single timeline that
has an ambient animation running and looping intially. I have three
more labeled sections of that timeline that each contain a
different animated sequence as click point animations for that
movie clip. I want the user to click on the button on the stage and
the first labeled click point animation of that movie clip will
play. I want that action to be stored so that when the user clicks
again then the second labeled click point animation will play then
they will click for the third in the same way. In between user
clicks I want the ambient animation loop in the beginning of that
movie clip timeline to play. When the user has clicked the 3rd and
last animated sequence then the whole thing will reset and be
available again. Can anyone let me know how that can be
accomplished. I originally scripted it through tell target to play
the first but I don't know how to move forward. Thanks!What version of Flash are you using? Telltarget is very
old... try something like this:
// array of the animations
myAnims = ['firstAnim','secondAnim','thirdAnim']; // these
are also frame labels
// your current animation index in the array, arrays start at
0,
// so we start at -1 which is like before anything
currAnim = -1;
// function to play the next animation
function nextAnim(){
// add one to the current animation index
currAnim++;
// if you've reached the end of the array, start back at 0
if(currAnim >= myAnims.length)currAnim = 0;
// now tell the MovieClip to play based on the value of the
current array index
myMovieClip.gotoAndPlay(myAnims[currAnim]);
Then on the button you just put:
on(release){
nextAnim();
And at the end of each animation on the timeline, put:
gotoAndPlay(1);
And at the end of the ambient loop at the beginning I guess
you have that, too, so it loops.
Hope that helps
Maybe you are looking for
-
Signed Java Code not acting as signed after 7.0 21 update
I have scoured the web and tried numerous things and nothing works. First, I am not a Java guru but I have done my homework here and all seems like it is signed correctly and should be working. The app was developed by someone else but we have the co
-
Allow User to Close & Come Back
Hello, I will be distributing an authorware package and I would like to give the user an option at the very beginning that allows them to close the package if they don't think they will have enough time to complete it and come back at a later time. I
-
I have a external RAID drive purchased from OWC. It failed. Most likely the housing no longer works. I have been told that without a housing designed for these particular drives I can't plug the drives into another case or adapter to access my dat
-
Lorsque je suis dans dreamweaver avec mon document, celui-ci est à mon goût Lorsque je le met sur internet, la présentation est différente Lorsque je fait une citation et donne une page de référence, sur mon document ok, sur internet non Exemple do
-
Problems saving in Illustrator CS6
Strange thing with Illustrator CS6. When I try to open or save a file I can only do this from dropbox??? But not from my harddisk. I work with a Mac book pro, with Maverick, but everything worked fine until now this morning. I can start a new documen