I have a main "shell" swf which, by clicking several buttons, will load/unload various external swfs into a Placeholder_mc which resides on the main timeline in Shell.swf In the documentation and tutorials I've seen a couple different methods, and I'm not sure I quite understand the difference, or at least the reason you would use one over the other...In the 1st method, you can just add the Loader object using the addChild() method:
Code:
var myLoader:Loader = new Loader(); var myURLRequest:URLRequest = new URLRequest("ExternalFileA.swf"); myLoader.load(myURLRequest); Placeholder_mc.addChild(myLoader);
This will apparently add myLoader to the display list once it has completely loaded.The 2nd method, you supposedly can add the Loader.content; however, it appears you can only do this once the content has completed loading, so you need to incorporate an event handler with the contentLoaderInfo object:
Code:
var myLoader:Loader = new Loader(); var myURLRequest:URLRequest = new URLRequest("ExternalFileA.swf"); myLoader.load(myURLRequest);
[code]....
What are the pros/cons of adding the entire Loader object, as opposed to the Loader.content and vice versa?
I've created a function that works on the main stage and I am trying to transfer it to an external class to make it an easily reusable function.When I run it however, everything works except for the fact that it doesn't put anything on the stage as it should. All the info it needs is there it's just not putting it there.Therefore I conclude that I am using the addChild(); incorrectlyhere is some of my code if needed:
ActionScript Code: public function drawBoard(i:int, j:int, tiles:Tile, boardArr:Array, stageBoardArr:Array):void {
I've created a couple of flash animations, fairly simple, but the whole relies on loading external swf files and then unloaing them.
The base file works fine, loads the externals and unloads them (although I need to preven the user from hitting the unload button when there is nothing to unload) and will then load another just fine, IF I run it directly from my file system.
I want it to be on a web page, but when you click the button to load the external files, nothing happens. Safari tells me it cannot find the file, and I'm using the exact same directory to test.
So, works fine when testing with flash (CS4) and running directly from the directory in finder, but from a web page, it cannot find the file.
When I add an object from the library to the stage in the timeline (by putting the script in the timeline) it works but when I try to add it from this .as file nothing happens.
What im trying to do here is use an external as file and linked it to the normal fla, inside this fla is one MC named movieclip. with the code below im trying to spawn the mc multiple times on the position where the mouse moves and the next mc on the next x/y here is the code:
ldr[nr][1][j2] = new Loader(); ldr[nr][1][j2].load(urlReq);
and about 3 seconds (by extra Timer script) after they're completely loaded are added to stage with
obj[nr][1][j2].addChild(ldr[nr][1][j2])
It all works properly, no problems at all. But by the time the .swf files are added as children to stage they've already animated 3 seconds of their own timeline so appear to "not start from the beginning of the animation".Any way I can prevent that in a simple way? (without requiring access / editing / recreating the loaded .swf or its .fla files)
I load external swf file into main movie. and i give that child a name page0 there is a bit of code.
[Code]....
so after its loaded i want to insert some text into external swf using main movie. i managed to remove external swf, like this ActionScript Code: holder_mc0.removeChild(holder_mc0.getChildByName("pages0")); but i wonder how to insert text into that swf. i don't understand how hierarchy works, when you addChild, what name should i use for my external files. for example ActionScript Code: holder_mc0. ?????? .mainTemplate.tContent.text = "TEXT"
I'm trying to have a class file which can add objects to the stage via addChild; however, when I call addChild from within the class file, I get the error "1180: Call to a possibly undefined method addChild." I've tried importing flash.display.* and that doesn't fix the problem. Does the class file have to extend Sprite or MovieClip to be able to add objects to the stage?
I have downloaded Box2d ([URL]) and created a project that looks like this: [URL]. catalyst is the green cube and it has the base class "shapes.box", it is inside "world" which has the base class "wck.World". What i want to do is to add another "catalyst" from the library inside "world" when i click on add_btn. I tried to accomplish this by this code:
[Code]...
Symbol 'buttons', Layer 'Actions', Frame 1, Line 41061: Call to a possibly undefined method addChild through a reference with static type Class.
Hon the wallets page, when you click to view a wallet you get a slight delay and I'm guessing that this is because I've put the preloader in the swf being loaded, hence not being able to see the thing your loading until its been loaded.how I would put the preloader in the main movie and what kind of code I would use? At the moment the timeline being loaded basically tells the playhead to goto and play frame (whatever) when the movie is loaded.
I've found lots of answers on making a button visable after a swf has loaded but not a flv. I am preloading an flv, well 20secs of it, then it starts playing. But I have a 'play' button on the stage and it sits there tempting people to hit it whilst the preloading bar works its magic preloading the flv. I want the button to be visable only after the flv has loaded or at least until it starts to play.[code]
i�ve written a small class for a image galery with preloader. but how to check if a image allready is loaded to hide preloader bar? i tried to discover with httpStatus, but unfortunetly this event is dispatched after the open/progress event - the code comes here
main class:
Code: package marek { import flash.display.*; import flash.net.*[code]...............
I have a container swf that preloads 4 other swf's and the user can navigate between all 4.
The problem is that once loaded, the animations for all the swf's begin immediately. So the animation for the 4 swf could be finished before the user ever sees it.
I've tried reloading the swf as a new URLRequest, but that caused an issue: when I test using a simulated slower connection it causes a slight delay in the loading of the swf.
The newMC doesn't show up.If I add 'parent.' in front of the addChild then it appears.mc_LibItem has a base class of "flash.display.MovieClip" and is exporting for ActionScript and on frame one.For grins I created a new .fla and began messing around with the same addChild idea and it worked.
my site is finished but as it's quite a large SWF the preloader and logo doesn't appear on screen untill it's load about 40% loaded.
Is there any way to get the logo on screen before anything else comes up rather than just having a black screen? (without breaking the main movie into smaller ones).
ive been building a site for about a month now and slowly piecing it together- so far ive managed to get all my various different levels loading and unloading the way i want them to, but now id like a little status bar to load on screen as my multiple levels are loaded in the background.The way ive been accomplishing this without the load bar is like so:on first frame of main movie loadMovieNum("dl_web.swf", 3);load MovieNum("dl_ illustration.swf", 4);loadMovieNum("dl_retouching.swf", 5);(the first frame of each of those movies has a stop function on it)And i have buttons on the main movie that make each of those levels visible and play.NOW, ive just created a movie clip ive named "bar" which is a thin rectangle, and i would like to have that movie clip load lengthways as my multiple levels are loaded in the background. So, my question is how do i accomplish this? I've looked all over and it seems like all the good preload tutorials are loading into movieclips whereas i am loading into levels.Right now my site is technically working, but there will be pauses for people with slower internet connections and i need my bar graphic to pop up so they dont think they are dealing with a broken site....
In my application, I make numerous calls to preload images to brower cache in the background using Loader instances and ignore the complete event. I don't store the results in the application, but rather want to store them in the browser cache. The images have long Expires header dates.
When I want to use a particular image(s), I again use a Loader instance and call the same url and listen for the complete event to load the file to an Image.
The problem is that when I re-request the url for the "cached" image, it is making an http request with response 200 status, which I presume means it is hitting the server. How do I make sure that a request for a cached image never hits the server from Flex? I am finding that any request to a url for a cached image (with a long expires header) is making another request to the server, or at least that is my interpretation of it in Firebug.
I'm trying out the preloader method shown on [URL] and its working fine until I use any reference to 'stage' in the loaded swf.
My loaded swf works fine if I test it on its own, but when I run the preloader which loads it, I get an error 1009 - I have found out (by a series of elimination) that its as soon as I reference 'stage' in the document class of the loaded swf
I recently put together a gallery based on examples that Stringy posted here.A couple improvements have been made, there is now a forward/back button that is sensitive to which photo you're on...thumbnails appear only on rollover. Run locally, it works perfectly.But there's a problem. For this particular project, there NEED to be 30 photos loaded in to the gallery, and they're biggish, average = 130k/per. When i'm running it live, the first 15 photos work fine (using the next/button) ... but once you reach the final 20...it CRAWLS. Most browsers I've tested it on crash at 28.Now, I don't know if this is just a feature of having so many images (if so, is there any way I can make a buffer of the next 5 images preloaded, and then delete those that were cached after I've viewed them?)
I'm trying to create a preloaded that reveals an image.example of what i mean is; when 10% is loaded 10% of the image is visible when 50% is loaded 50% is visible.
I have a SWF file, and it accesses an XML file. It works just fine when debugged or published into a standalone SWF. HOWEVER, when I add a preloader to it, I get the following error, every single time:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
It works just fine when running on it's own, but when it runs through a preloader, it will not work.
I need to preload 12 images and 12 mp3 files, and the xml file for my text, at the beginning of my swf file.
Is there any fairly easy way to do this? I've searches for tutorials/examples, but can't find anything helpful. Is there a way to preload a folder, where I can keep these files? Or some way to get all files preloaded in the same preload progress?
written a small class for a image galery with preloader. but how to check if a image allready is loaded to hide preloader bar?i tried to discover with httpStatus, but unfortunetly this event is dispatched after the open/progress event hintthe code comes heremain class:
is finished but as it's quite a large SWF the preloader and logo doesn't appear on screen untill it's load about 40% loaded. Is there any way to get the logo on screen before anything else comes up rather than just having a black screen? (without breaking the main movie into smaller ones).