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;
Similar Messages
-
How to load swf into a movie clip?
i have an swf file i want to load into a movie clip within my
flash file, i think im supposed to use loadmovie () instead of
loadmovienum, can anyone help me out? thanksloadMovie("X",Y);
Where x is: the url of the swf file you want to load.
Where y is: the name of the movieclip you want to load it
into. You must give the movieclip an instance name.
For example, if I wanted to load '1.swf' into a movieclip
with an instance name of "loaderclip," my code would be:
loadMovie("1.swf", loaderclip); -
How can I load an external SWF into a movie clip that's inside other movie clip?
Hi.
I creating my first flash (actionscript 3.0) website but I'm
stuck with a visual effect I want to create.
I have a window on my website called contentWindow. Every
time you click a button this window is supposed to leave the stage,
load the requested content and return to the stage.
The sliding window is a movie clip with 83 frames, 21 to
enter the stage, 21 to leave the stage again, 20 for nothing (its
just to simulate the loading time) and 21 to return to the stage.
Now my goal is, when the user clicks on a navigation button,
the window exits the stage, loads an external SWF with the content,
and then returns to the stage.
I've the "window" movie clip with an instance name of
"contentWindow". Inside there is another movie clip with an
instance name of "contentLoader". The content that the user
requested should appear inside the "contentLoader".
Now, when the contentWindow leaves the stage, I get this
error message:
quote:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at rwd_fla::MainTimeline/trigger()
If I switch
"contentWindow.contentLoader.addChild(navLoader);" for
"contentWindow.addChild(navLoader);" it works fine, but the
external SWF doesn't move with the window.
How can I load an external SWF into a movie clip that's
inside other movie clip?Hi,
Recently, I have been putting together a flash presentation.
And I am just wondering if the following might help you, in your
communication with the said swf file:
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onComplete);
function onComplete(event:Event):void
event.target.content.thinggy_mc.y -= 100;
Not the best example, but this allows you to target a mc
within an external swf file. I think if you look up this code, you
will have an answer ;)
Kind Regards,
Boxing Boom -
How can I call in swf file to movie clip?
Hi all ...
This is my first post for advise, although fairly conversant
with flash and as2.
I am developing a new full screen background style website
and have menu buttons contained within a movie clip (nav_c1) ...
this re-aligns to the top centre of a page when user scales the
browser window.
I then have the content area (centre_content) movie clip ...
this realigns to the centre of the page when a user scales the
browser window.
I have scripted the menu buttons to goto a labelled frame in
the main timeline but I need, when at the labelled frame, to be
able to call/load in an external swf file to play 'inside' the
centre_content movie clip?
for example:
If I click my news button the flash file moves to the frame
label news on the main timeline. This then shows a duplicate of the
moive clip 'centre_content' which is called 'centre_news'. I need
to be able to call/load an external news.swf, containing all the
animated news info, to sit and play 'within' the movie clip
'centre_news' ... so that it is effectively contained 'within' the
movie clip file but loaded in place from an external swf file.
Can anyone help please?
I can post a rough working example online if need be.
Many thanks
A puzzled Adrian
ps: I don't think I am needing to load the swf to a level 1
area as I have tried this and instead of the swf file being loaded
and contained within my movie clip file/area it instead seems to
sit fixed on the main timeline (ie: not contained within the movie
clip area).Thanks Sketchsta for you code. This looks like we're on the
right lines as I see what the code is trying to do.
Unfortunately though I can't seem to get this to work?
I created a new file to get rid of other scripting that was
going on and have placed a movie clip called centre_content onto
the main timeline in frame 1 ... then I have applied your script to
an actions frame above the movie clip also on frame 1. I change the
path_to_file line with my swf name (callin.swf) which is a 1 frame
flash file with some text on it ...
... but it doesn't bring in the callin.swf file ... it just
shows the centre_content clip.
Am i doing anything wrong?
I also tried putting the script onto the first frame inside
the centre_content movie clip but this doesn't appear to work
either.
Regarding the pre-loader ... can I simply build this into the
swf file that is being called in to the movie clip?
Thanks in advance for your support, it is much appreciated.
Adrian -
SWFs containing 3d movie clips do not display correctly
I'm having difficulty using a swf with a 3d movie clip, it's displaying much larger in captivate than it does in any other context. Are there known issues with 3d clips in captivate?
Hi GCemb,
Thank you for contacting Adobe Support.
Can you please and insert an .mp4 3D video clip using though Event video option in Adobe Captivate.
We tested the same at our end and the video is working fine.
Thanks
l.oveesh -
Having trouble opening a .swf in a movie clip
Okay, so I have been searching around quite a bit to get this
figured out.
I have my main .swf file which is pretty much my entire site
and I want to open a few other galleries separately to quicken up
the loading time. So I created the galleries I want to open as
their own .swf files. when I use the loadmovie command it will open
the gallery but nothing from the original main .swf file is there,
so none of the navigation buttons or borders are there so I can't
go from gallery to gallery.
I am trying to explain the best I can, if anyone can help me
I would appreciate it a lot.Are you loading this new gallery .swf into an empty movieClip
in the main .swf, or, are you loading the new gallery .swf in place
of the main .swf?
If you are loading in the gallery .swf into an empty
movieClip, is this new .swf physically smaller than the main .swf?
Are you hiding the main .swf with the newly loaded .swf? -
How load variables to a movie clip on a masked layer on my main time line
the problem I have is that I been trying to load text from a
text file news.txt into a movie clip on my main time line the
problem is when the layer where the video clip is locates is masked
the variables will not load, but it does work when the layer is
unmasked, but then the website does not work the way it is suposed
to look.
any Idea on how I can get arround this????PArt of the problem will be due to declaring the uiLoader inside of a function. When you do that you limit its scope to within that function. You should declare it outside of any function if you need to access it in more than one function.
import flash.events.MouseEvent;
import fl.motion.MotionEvent;
var uiLoader:UILoader;
var targetObj:Object;
The other problems I see regard the line you point to. It is not spelling the name the same, using a lowercase "l". Also, if you want to target what the UILoader contains, you should target its "content" property, as in...
targetObj = uiLoader.content.mask_01 -
How can I check the progress of a Loader from within a movie clip?
Hi All,
I have a Loader called profileContentLoader that I create in AS3 on the main timeline, I would like to check the bytesLoaded of profileContentLoader from within a movieclip thats in another movieclip....
I tried:
MovieClip(root).profileContentLoader.bytesLoaded
but that doesn't work....
Thanks for any helpThe Loader class uses a LoaderInfo class object to do its loading event informational bidding. Look into the contentLoaderInfo property of the Loader class and then followup looking at the LoaderInfo class to see what you can make use of from it.
-
Preloader for a scrollPane?
hey all,
i'm loading a large (250k) movie into a scrollPane, and am
having serious issues trying to get a preloader to work in any
fashion. i've tried placing the preloader in the root level, but
the scrollpane forces the 250k to export on first frame to be
functional, thus making the preloader useless. i tries also to put
a preloader into the loaded 250k movie, but that made no
difference. is there a way around this, or are users just going to
have to wait on faith for the blank scrollpane to populate itself?
thanks,
morganonce again, i answer my own question. i found out that the
preloader wasn't working because the inherent nature of "Export for
ActionScript" necessary for amking a movie loadable into a
ScrollPane loads that content at the very beginning. if you go into
the publish settings for the Flash output and click on the Settings
button next to the ActionScript Version selector, you can set which
frame of the movie you want to expert frames for classes to. set
this to frame 3 (most preloaders take up the first two frames), and
suddenly the preloader functions fine. -
Calling functions / setting variables in loaded SWF
You know how you can create a Movieclip object, add a
function or variable to it, then call that function or change that
variable from within the SWF that includes it? I wanna be able to
do that, only with SWFs that are loaded at run time.
My "main" SWF is simply a menu-type thing. The user clicks a
button in my MAIN.SWF, and the MAIN.SWF then loads the SWF that's
associated with that button, using the AS 3.0 prescribed
Loader()-URLRequest()-addChild() method that everyone always asks
about.
This works great. But now I've got some custom objects and
such (ie., not just strings) within my MAIN.SWF that I'd like to be
able to share with the loaded SWFs. Preferably, I'd like to use an
accessor-type function (ie.,
LoadedSWF.GiveMeTheCoolObject(MyCoolObject);), though at this point
I'm willing to hack into the object itself (ie.,
LoadedSWF.CoolObject.CoolField = MyCoolObject.CoolField;) if that's
what it takes.
I've tried just calling the functions and setting the fields,
but the AS 3.0 compiler doesn't care for that sort of nonsense on
it's generically-defined objects. Notice also that, at run time, a
call to LoadedSWF.hasOwnObject("GiveMeTheCoolObject") returns true.
So my big-brained colleagues, what's the magic?
In advance, thanks for the help!
ScottKglad,
quote:
Originally posted by:
kglad
from that error message it appears your function is expecting
a member of the MyCoolObject class, correct?
and MyCoolObject is not an instance of that class. so, you
need to fix that. ie, create a member of that class and use that
class member as the function parameter.
Heh, that's what the error message says all right. But the
object actually IS a MyCoolObject class object. I stared at this
thing for hours, and MyCoolObject IS an instance of that class. I
tried various casting combinations (including casting it to an
Object and passing that) but had no luck whatsoever.
So I googled this particular runtime error message ("Error
#1034: Type Coercion failed: cannot convert ") and found a ton of
links to other people having a similar issue. Typically, the
problem was just as you said, someone passing a button as a string,
that kinda thing. But one guy had a problem with an object he
derived from the Event class. After hours spent trying to get it to
work, he tried overriding the base class' clone() method and got it
to work:
http://www.asserttrue.com/articles/2006/10/14/custom-events-in-actionscript-3-0
As for my project, I took a long hard look at the overall
architecture of my project and decided that it was best if all the
"real work" took place in the MAIN.SWF file. This approach would
solve a couple of other problems, and it just makes sense in a
"separate the display from the data" mentality.
So (and this is the interesting part) I changed the API for
the LOADED.SWF to accept String pairs (ie.,
LoadedSWF.AddToDisplay(Name:String, Data:String) ) instead of
accepting MyCoolObj. Ran it, and Viola, now we're working without
any run time exceptions. After that glorious moment, I created a
couple of other APIs that just accepted base classes (one an int
type, the other a function type) and was happily on my way.
From this, I gather that passing non-base class (ie, derived
class) objects to loaded MovieClips via custom function APIs is...
maybe not as straightforward as we'd expect. In the grand scheme of
things though, not a big deal: As far as I'm concerned AS3 rocks.
Again Kglad, thanks for all the help: Your input on how to do
this was the big push that I needed to get over the last technical
hurdle of this project.
To those who are reading this topic for the "how do I call
functions and/or set variables in a loaded SWF?"
The short answer is to cast the loaded SWF's content object
as a MovieClip and then call the function or alter the variable:
//Load the SWF (you've seen this code a million times)
var LoadedSWFObj:Loader = new Loader();
var MyURL:URLRequest = new URLRequest("LoadThisSWF.SWF");
LoadedSWFObj.load(MyURL);
//This is within your Event.COMPLETE handler:
//Cast it as a MovieClip object and work with that.
var LoadedSWF:MovieClip = LoadedSWFObj.content as MovieClip;
// or another way to cast it is:
var LoadedSWF:MovieClip = MovieClip(LoadedSWFObj.content);
//Call yer function:
LoadedSWF.CallMe(); -
Controling a loaded swf into movieClip
help!!
i have loaded a {slide swf} into a movieClip .. on stage ..
using the
var loader:MovieClipLoader();
using a button movie clip the is embeded into a seperate swf
file that is loaded in at run time
but the {slide swf} is runing a Interval that i need to clare
... so is there a way to talk to swf file after you load it into a
movie Clip how do you address thatvar kglad : Master = new Master();
Kglad .onReply=function(){
" you are on to somthing big [ only the second picture fade
in and thats where it stop ] it deos not seem to bee loading any
more ... but when you click the next _btn.
the caption keep changing ... but pictures don't change
"........ i am sending you a better view of what ihave
done<<<<<<<<<<start... // create
variables
var x:XML = new XML();
x.ignoreWhite = true;
var urls:Array = new Array();
var captions:Array = new Array();
var captions2:Array = new Array();
var whoIsOn:Number;
//XMl function
x.onLoad = function() {
var photos:Array = this.firstChild.childNodes;
for (i=0; i<photos.length; i++) {
urls.push(photos
.attributes.url);
captions.push(photos.attributes.caption);
captions2.push(photos
.attributes.caption2);
holder.loadMovie(urls[0]);
caption.text = captions[0];
caption2.text = captions2[0];
whoIsOn = 0;
//Load XML
x.load("pics/kingslandMarks/lmlist.xml");
// The Button envents
previous.onRelease = function() {
clearInterval(nInterval);
if (whoIsOn>0) {
whoIsOn--;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
caption2.text = captions2[whoIsOn];
next.onRelease = function() {
if (whoIsOn<urls.length-1) {
whoIsOn++;
clearInterval(transitionI);
transitionI = setInterval(transitionF, 50, wholsOn);
caption.text = captions[whoIsOn];
caption2.text = captions2[whoIsOn];
function transitionF(index) {
if (!fadedOut) {
holder._alpha -= 4;
if (holder._alpha<0) {
fadedOut = 1;
holder._visible = 0;
} else {
if (!loadStart) {
holder.loadMovie(urls[whoIsOn]);
loadStart = 1;
if (!loadComplete) {
if (holder.getBytesLoaded()>0 &&
holder.getBytesLoaded()>=holder.getBytesTotal()) {
holder._visible = true;
loadComplete = 1;
holder._alpha = 0;
} else {
holder._alpha += 4;
if (holder._alpha>=100) {
clearInterval(transitionI);
/*next.onRelease = function() {
clearInterval(nInterval);
if (whoIsOn<urls.length-1) {
whoIsOn++;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
caption2.text = captions2[whoIsOn];
var s;
//Experimenting with auto play slide show
var nInterval:Number;
autoPlay();
function autoPlay() {
function neXt():Void {
if (whoIsOn<urls.length-1) {
whoIsOn++;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
caption2.text = captions2[whoIsOn];
if (whoIsOn == urls.length) {
clearInterval(nInterval);
whoIsOn = 1;
function prEv() {
if (whoIsOn>0) {
whoIsOn--;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
caption2.text = captions2[whoIsOn];
auto.onRelease = function() {
nInterval = setInterval(neXt, 2000);
this._visible = false;
sTop._visible = true;
if (whoIsOn<urls.length-1) {
whoIsOn++;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
caption2.text = captions2[whoIsOn];
sTop.onRelease = function() {
clearInterval(nInterval);
this._visible = false;
auto._visible = true;
//try to fade the movieClip holder
function fade():Void {
holder._alpha -= 5;
if (holder._alpha == 20) {
holder._alpha = 100; -
Loading swf into empty mc in a html page
Hello Flashers,
I've set up a html page that contains a swf file with an
empty movie clip in which I wish to load another swf.
However I trie to do it, it just won't listen.
Can anybody help me with this.
Situation:
html page (complete one, with tables etc.) contains main swf
file (in a table) which contains an empty movie clip.
Within the main swf there is a button which should load
another swf file into the empty movie clip.
What happens is that the external movie clip is loaded into
level 0 of the main movie.
It usualy works fine just with flash site but within the html
page it results differently.
Is it possible to get it right.
Thanks
Justin TimeUrami, thanks for your interest for helping me ( and others,
as far as I know )
I'll try to explain it in more details ( although english is
not my language)
I've made a html page which contains a swf file ( theMAIN )
in one table, other tables are filled with gif's, jpeg's etc.
In the main movie - theMAIN - there is a empty movie clip
with instance name "deder_mc" which is ment to accept loaded swf's.
There is also a button with action ---- on release :
_global.theMAIN.loadMovie("./swf_s/000_studioG.swf", "deder_mc");
That means, when user click this button movie
000_studioG.swf should be loaded into deder_mc empty movie
clip.
The movie 000_studioG.swf is located in swf_s folder in site
root.
_global.theMAIN = this;
is a action script in a first frame of the main movie so it
build a reference to it.
I've done it before but site was built complete in Flash and
I did not had any problems with loading external movies into empty
movie clips. Not long before I've red somewhere(don't remember
where) that this don't work in swf in a html page.
But I live in a hope that I would be able to build a html
site which contains swf which can load external movies into empty
movie clips. So I am looking for solution.
I hope it's enough information for you to tell me a solution
if you know the right answer.
Thank you. -
Attach mc's from parent SWF to loaded SWF
I've got a movie (parent) that loads several other SWFs
(children). I need for the parent SWF to attach movie's to the
child SWFs from it's library - but i can't get it to work.
Is there a way to do this?If the children are loaded into empty clips, they can be
addressed via the instance name of the empty MC, and you can use
holderMC.attachMovie("linkageID","newName",depth);
to attach the symbol with "linkageID" to the MC loaded into
the instance "holderMC".
hth,
blemmo -
Load SWF with instances into MC
Hello,
I have a SWF called "player.swf", and it contains instances
like: "head", "body" etc...
I want to load that SWF into another SWF
("display_player.swf"), and to load ANOTHER SWF to replace the
"head" instance, like:
"_root.p" is a transparent red colored movie clip inside
"display_player.swf"
I tried doing this:
_root.p.loadMovie("player.swf");
trace(_root.p.head);
"_root.p" said to be "_level0.p" and is displayed correctly,
but "_root.p.head" said to be undefined (NaN)...
Does anyone has an idea on how to load a SWF inside a movie
clip, and use it's instances?The point here is to demostrate, or at least determine, what
the problem is. I have stated that it is probably likely that you
are making the call to _root.p.head previous to it being
instatiated on the timeline. you must wait for the swf to load
before the clip within the loaded swf can be made available to
target. A better method would be to use the MovieClipLoader class,
and then use the onLoadInit handler, this handler is displatched
when the swf becomes available to the timeline, then within the
handler you could call your trace, or load into the 'head' instance
at the correct time.
I have made an example to demostrate this, using
representations of you clips and swfs:
HERE
PS. launch the items from within the folder. -
Bitmap Font gets blurry when its swf is loaded into a movie clip
I have a gallery i'm working on, located here:
http://www.stationarynotes.com/portfolio/Gallery.html
If you click the first button (the one that looks like a
splattered "S" in black ink) you'll see that my bitmap text gets
rendered all blurry. That swf which is being loaded renders fine
when I test it by itself. The text is positioned with whole numbers
and aligns to the grid within its own swf, and the movie clip which
receives it is also positioned with whole numbers. Do you think
perhaps when it is loaded into another MC it is being pushed off of
the grid somehow...? I'm really confused.
I can post my .flas if that'll help.bitmap fonts look best when positioned on a whole pixel
number (100.0 instead of 100.4 for example).
If you are loading into an empty clip - try placing that clip
on the nearest whole number. or you
could load the external swf to a level with will position it
at 0,0 (upper left corner of stage).
--> **Adobe Certified Expert**
--> www.mudbubble.com
--> www.keyframer.com
Scruffpuff wrote:
> I have a gallery i'm working on, located here:
>
http://www.stationarynotes.com/portfolio/Gallery.html
>
> If you click the first button (the one that looks like a
splattered "S" in
> black ink) you'll see that my bitmap text gets rendered
all blurry. That swf
> which is being loaded renders fine when I test it by
itself. The text is
> positioned with whole numbers and aligns to the grid
within its own swf, and
> the movie clip which receives it is also positioned with
whole numbers. Do you
> think perhaps when it is loaded into another MC it is
being pushed off of the
> grid somehow...? I'm really confused.
>
> I can post my .flas if that'll help.
>
Maybe you are looking for
-
Late '13 rMBP issues w/ Dell 4k Display
I have the Dell p2715q 27" 4k screen and 2 rMBPs: Work - late 2013 with discrete GPU running 10.9.5 Personal - mid 2014 with discrete GPU running 10.10.2 When I first set up the monitor a few weeks ago, I used it for a few days with the work computer
-
Why is my iPod Touch 2nd Gen not recognized by iTunes on my iMac?
-
How can I open "Place..." dialog from my plugin?
Hello All, There is a "Place..." item in "File -> ...". If we can click on "Place...", "Place" dialog will open and asks for .ai file to place the whatever the art is there in that file in the current document. Right. Now what I want is, if I click
-
How much is 4gb of ram enough for?
I just got a 4gb oF RAM MacBook Air. I was wondering what kinds of applications I will be able to use side by side without slowing down. Also, of I ran photoshop by itself would it be ok?
-
ClassCastException casting CallableStatement to OracleCallableStatement
Im trying to create a ViewObject based on a REF_CURSOR returned by PL/SQL stored procedure OUT parameter. I casted the normal CallableStatement to OracleCallableStatement so I can call the OracleCallableStatement.getCursor(index); CallableStatement s