Load swf once in all scene (AS2)
hello ,
i have flash with 3 scene .
i load a external swf in movie clip in scene 1 .
but when i go to next scene external swf load again .
i don't want it load again , it's load in scene 1 .
please HELP .
i'm sorry we have a miss undrestanding .
i don't want to remove the movie clip , but i don't want it to load again , you know , you have to load external swf ( size 300 KB ) in scene 1 , and wait to load , and when you go to next scene it's load again and you must wait again , i mean what's the way that it load only once for all scene ?
Similar Messages
-
Calling Flex function from loaded SWF
Hello,
I need to load an external SWF file, wity ability to call functions from the base FLEX code script .
Is that possible ? noting that the loaded SWF can be either in AS2 or AS3
Thanks in advance ..There are some third party ways of talking to an as2 swf. Google
as2interface (or maybe as3interface) -
How can I reference the main timeline on a swf once it was loaded into another?
I have an swf with some custon animation functions using actionscript 3. I'm refering to the main timeline with Movieclip(root) and it works just fine.
However, this swf is going to be loaded inside another (a custom player), and when that happends, everything stops working.
I think it's because the Movieclip(root) is now referencing to the loader swf and not the loaded anymore, but I just can't find any information on how to fix that.This is basically what I´m doing here:
I'm placing this code on frame 1, and calling the function textAnimate() whenever I need to insert some text.
// This is a variable I created for tracking the timeline
var base:MovieClip = MovieClip(root);
function textAnimate(movieName:String, espera:Number):void {
//var espera:Number = 1; //Waiting time
var objeto:MovieClip = base[movieName]; //Variable to select the object
var posFinal:Number = objeto.x; // Object position
var posEnter:String = "-160"; // Animation start (relative)
var posExit:String = "+160"; // Animation end (relative)
// enter animation
TweenMax.from(objeto, 1, {x:posEnter, alpha:0, blurFilter:{blurX:40}, ease:Back.easeOut});
//call exitAnimation() after X seconds
TweenMax.delayedCall(espera,exitAnimation);
//exit animation
function exitAnimation() {
TweenMax.to(objeto, 1, {x:posExit, alpha:0, blurFilter:{blurX:40}, ease:Back.easeIn});
The swf works fine, but once it´s loaded into the player, nothing works anymore. Unfortunately, I don't have the code for the player, and can't change anything about it... :/ -
When I use Call Library Function Node in real time, is the DLL loaded once for all or load every time when it is called?
I have a time critical real time application, in which I use a piece of DLL function developed by C++. It is OK? Could any senior developer assure me?
Thank you in advance.
Solved!
Go to Solution.qing_shan61 wrote:
When I use Call Library Function Node in real time, is the DLL loaded once for all or load every time when it is called?
Once
qing_shan61 wrote:
I have a time critical real time application, in which I use a piece of DLL function developed by C++. It is OK?
OK
Be sure that all DLL calls are thread safe (do not perform calls in UI thread).
Also for real-time application you need real-time OS.
Andrey. -
Scrollpane all screwy inside loaded swf
I have had this problem using both the scrollPane component
from Flash 8 and an open source code scrollpane that I found in
Flashkit. I have an swf in which I'm using a scrollPane which works
fine when I test the movie. However, I'm loading this swf into
another master swf using loadMovie. When I do this, the scrollpane
inside the loaded swf gets really buggy. First, the scrollbar will
not stop scrolling when I release the mouse. Also, the whole
scrollPane gets a green highlight around the edges (except in the
open-source code scrollpane). HELP!! Does anyone know how to load a
scrollPane into another swf without it getting all weird?//below is the code for the "slideshow.swf"
//For the main movie.. I'm doing....
button_btn.onRelease = function() {
myMovieClipLoader_mc.loadMovie("slideshow.swf")//
this.createEmptyMovieClip("container_mc",this.getNextHighestDepth());
this.createEmptyMovieClip("buttons_mc",this.getNextHighestDepth());
//loader//
this.attachMovie("loader2","loader_mc",this.getNextHighestDepth());
loader_mc._x = (Stage.width - loader_mc.width)/2;
loader_mc._y = (Stage.height - loader_mc.height)/2;
var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myMCL.addListener(myListener);
myListener.onLoadProgress =
function(target,bytesLoaded,bytesTotal) {
loader_mc._alpha = 100;
var pct = Math.round(bytesLoaded/bytesTotal*100);
loader_mc.bar_mc._xscale = pct
myListener.onLoadComplete = function(target) {
loader_mc._alpha = 0;
//button movies//
buttons_mc.attachMovie("prev","prev_mc",buttons_mc.getNextHighestDepth());
buttons_mc.attachMovie("next","next_mc",buttons_mc.getNextHighestDepth());
buttons_mc.next_mc._x = Stage.width -
buttons_mc.next_mc._width;
buttons_mc.next_mc._y = 10;
buttons_mc.prev_mc._x = 10;
buttons_mc.prev_mc._y = 10;
//variables//
var numPics:Number = 5
var picArray:Array = new Array();
var currentElement:Number = 0;
for (i=0;i< numPics;i++) {
var location:String = "pics/pic0" + (i+1) + ".jpg";
picArray.push(location);
myMCL.loadClip(picArray[currentElement],container_mc);
//next button//
buttons_mc.next_mc.onRelease = function() {
if (currentElement < picArray.length-1) {
currentElement++;
else
currentElement = 0;
myMCL.loadClip(picArray[currentElement],container_mc);
//prev button//
buttons_mc.prev_mc.onRelease = function() {
if (currentElement > 0) {
currentElement--;
else
currentElement = picArray.length-1;
myMCL.loadClip(picArray[currentElement],container_mc);
} -
Loading a 2nd SWF once 1st is finished, and a 3rd, then a 4th
Hi, ive been pulling my hair (we all did isnt it...) with this simple one. I DID past the last two days trying by myself, as its the better way to learn. But now, i am out of time and out of ideas. Here it is.
- I have a main swf file, named holder.swf, in which i have
var loaderM:Loader = new Loader();
var loadUn:URLRequest = new URLRequest("un.swf");
loaderM.load(new URLRequest(loadUn));
addChild(loaderM);Try a different approach where you let the main file do all the traffic control and your loaded swfs just honk their horns when they are done.
In the last frame of your 50 secondary swf's you just put...
stop();
dispatchEvent(new Event("swfComplete"));
The main file code would be something like...
var count:uint = 0;
var swfArray:Array = new Array("un","deux","etc..."); // all your swf file names
var loader:Loader = new Loader();
addChild(loader);
function loadNextSWF(evt:Event=null):void {
var url:String = swfArray[count] + ".swf";
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, assignListener);
loader.load(new URLRequest(url));
count += 1;
if(count == swfArray.length){
count = 0; // start over
function assignListener(evt:Event):void {
// this assigns a listener for the swf's dispatched event
MovieClip(evt.target.content).addEventListener("swfComplete", loadNextSWF)
loadNextSWF(); // start the show off
By having the main file manage everything via using the array, it allows you alot of freedom in terms of adding to and removing from the show. You only need to change the array content to add or remove swf's.... and you can code all the swf's generically. That can lead the way to having an xml file that provides the names of the files so that you don't have to edit/recompile any of the Flash files when file data changes.
Things can probably be refined in the main code above, but those are the basics to have it functional. -
Targeting the timeline of a loaded swf - AS2
I'm loading an external swf into a project and I want to be able to start and stop the loaded swfs timeline at will....
I'm loading swf into an MC:
loadMovie("myFile.swf", swfHolder_mc);you can reference the loaded swf's main timeline by referencing swfHolder_mc AFTER loading is complete and the swf is initialized.
-
I've created a 'plugin' SWF file in CS3 using actionscript 3.
The purpose of this file is to be included as a postroll in the
open source flash media player JW FLV/Media Player (
http://www.jeroenwijering.com/?item=JW_Media_Player).
I have heavily customized the media player libraries to do
various new things/alter how things worked, and now want to be able
to include the SWF file within this into a child sprite/movie clip.
HOWEVER, the problem lies in that the media player is written
completely in AS2, and therefore I have to use the MovieClipLoader
class to load in the SWF. Updating the source to AS3 isn't an
option unfortunatly, and downgrading the AS3 SWF to AS2 isn't an
option either, mainly due to the fact I've learnt AS3, not AS2, and
find it frustrating trying to find the AS2 equivalent to the AS3
methods I know.
The problem though lies in that MovieClipLoader does not like
my SWF at all. Initially I was presented with a load of sandbox
errors from when it was loaded in, which I then resolved so that no
security errors are produced. However, whenever I load in the clip,
the target sprite/clip is empty. I have gone through checking that
no errors occur on load, and it reports that the loaded SWF has
been initialized, yet I see nothing. Also, the code loading the SWF
is not at fault as it loads any other SWF (even another AS3 SWF
which just creates a rectangle) no problem.
Oddly enough, using the MovieClip.loadMovie method works in
one situation - when you load it into the root of the AS2 file.
When loading it into an empty movie clip, the same problem of a
blank clip occurs. The problem is not specific to the media player
either, as it happened in any AS2 file where I was testing how to
load in the AS3 SWF.
If it is of any use, the sandbox errors produced by the AS3
file when loaded into AS2 swf I had to resolve where to do with
stage access for getting the stage height and width, and a
Loader.content error when pulling out the BitmapData. These were
resolved via setting the allowed domains policy and eliminating any
reference to stage.stageHeight/With.
Does anyone have any ideas on how to solve this? The only
possible solution I've been able to think of so far since the AS3
swf won't display is to play with the LocalConnection class as
tests showed I can communicate between the AS2 and AS3 files, but
this would have to be a last resort, and is less than ideal when
there can be multiple instances of the player running (I would need
to use unique connection names for each instance so as to prevent
player A interacting with player B, and also as only one of the
players can listen on the connection at once).I have the component in the top level also,
I get this error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\BaseButton.as:615]
at fl.controls::LabelButton/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\LabelButton.as:724]
at fl.core::UIComponent/drawNow()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1343]
at fl.controls::List/drawList()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:594]
at fl.controls::List/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:474]
at .tree::TreeList/draw()
at fl.core::UIComponent/callLaterDispatcher()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1532]
I've checked the definitions for the tree component,
The LabelButton and List I don't have much control over.
I'm not sure how to fix this. The xml is correct and loads easily if it's in the root document.
The list component doesn't load the labels, It stops on the first one.
What do I do next? -
ipad i have load swf file but swf is not working proper(flex 4.6) but android is fine to work how
On the MBP, in iTunes, switch to Song view and enable the iCloud Status column by pulling down View > View options and selecting the option for "iCloud Status." Close the small window. Look for any tracks that have a status of "waiting." If you see several of them disable iTunes Match while holding down the Option key. Quit iTunes, wait a few seconds, then open it again and turn iTM back on. Let it compelete the scan. Wait until all tracks that are "waiting" have a status of either "matched" or "uploaded."
On the iPad, turn off iTunes Match then launch the Music app and let the contents clear out. Power cycle the iPad for good measure, then re-enable the service once all the tracks in iTunes have been processed. -
Load SWF into empty movieClip?
Hello,
Could anyone please point me in the right direction to find
out how to load an external SWF into an already existing movieClip
instance that is already placed on the stage? This is the way I've
always worked in AS2, but I can't find how to do it in AS3. Can
anyone point me to an example where URLRequest works with a
specified movieClip instance?
Thank you!I understand why you might think I was ignoring your advice,
but this isn't the case. You're expertise is much valued and
respected.
My purpose for continuing to experiment with loading into a
movieClip was an attempt to find an easy way to layer the SWF
behind other elements, but as you know, although it works for this
purpose, it doesn't allow control of the loaded SWF from the main
timeline. For others struggling to learn as I am, here's a link
where I found the answer to my question above:
http://www.hostingforum.ca/776586-as3-controlling-loaded-swf.html
The transition to AS3 is not as easy for some as for others,
and there are new concepts to understand.
Don't know what "nvm" means... curious, but might be better
off not knowing ;) Thanks again for all the help you offer to all
of us who are struggling. -
Controlling a Movie Clip on the Main Timeline from a loaded SWF?
Is it possible to control a MovieClip on the main timelne from another loaded clip?
I see posts that control loaded clips, but most are all from the loader in the main timeline. I have a moviclip on the main timeline that I want to make visible or invisible depending on what keyframe is playing in another loaded swf.
If I try to call the movieClip from the loaded SWF I get "error #1119. Access of possibly undefined property...." because it doesn't exist in the loaded SWF, just the main timeline.
The old AS2 way just used "_root". Since "_root" doesn't exist any more, how do you control items on the main TimeLine from a loaded SWF?I am not clear what you mean because you are saying you are trying to target a movieclip that does not exist where you are trying to target it.
Try using a trace to see what you are targeting when you you target the MovieClip(parent.parent)....
trace(MovieClip(parent.parent));
The other approach I mentioned earlier is the more OOP-correct approach if you would rather try that way. Here's a rough outline of it...
AS3 - Dispatch Event
http://forums.adobe.com/thread/470135?tstart=120
Example:
Add something to trigger the event in the child (your loaded swf):
dispatchEvent(new Event("eventTriggered")); (
if dispatchEvent problem, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)
In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo. In the complete event handler, add a listener for the event on the loaded swf.
// event handler triggered when external swf is loaded
function loaderCompleteHandler(event:Event) {
MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
function eventHandler(event:Event):void {
trace("event dispatched in loaded swf");
// this is where your main file can set the visible property of your movieclip -
Small Bug in Flash 8: loading swf that´s a vectorized image in many layers
Hi! There´s a small bug in flash 8. If you load a swf
that it´s a vectorized image in many layers, when you give it
an action in onLoadInit, like mc.onRelease, the mc don´t
"catch" that action. You can try loading an image (it works), a lot
of swf (it works), but with this kind of swf the actions onRelease,
onPress, etc... don´t work.
The
swf
I´ll make a different vectorized image to make it works
(if there is only one layer it works)Seems odd it will only run once. Usually if a cache problem
you get the same
results even when you update the movie or server scripts.
If it is
http:// it is not local even if from the browser
cache.
Verify the html is validated.
Check to see if this applies to all swfs. Create a simple
hello world swf
that connects to a JSP script that returns a simple value to
Flash. If that
seems to work, then the problem is in the JSP or
Actionscripting coding.
Check you can load the JSP script repeatedly using a direct
call to it on
the browser line using
http://.
Lon Hosford
www.lonhosford.com
Flash, Actionscript and Flash Media Server examples:
http://flashexamples.hosfordusa.com
May many happy bits flow your way!
"srikanth_s_india" <[email protected]> wrote
in message
news:e6obld$lfb$[email protected]..
> Thanks for the article link.
>
> I can't provide the URL as it is within our application
which requires
> logging
> in. However, one more interesting thing about it is that
it always works
> for
> the first time (in the browser/machine) but not from the
next time.
>
> My doubt is whether it is because of the caching? When
it loads for the
> first
> time, the HTML and SWF files load from our server and
hence are allowed to
> communicate with our JSP. However, when it loads the
subsequent times, it
> probably loads from the cache and hence considered as a
local file and not
> allowed to communicate with our JSP file which is on the
Internet.
>
> Can anybody tell me how to enable a local SWF file to
load SWF files from
> the
> Internet & access URLs from the Internet in Flash 8
pluggin?
> -
Can't Access MovieClips and Functions in Loaded SWF
Hi everybody,
I'm trying to simply access anything inside this loaded SWF and all I get is 'null'.
I have code in the parent SWF that needs to tell the child SWF movieclip what to do but nothing works. This was a piee of cake in AS2 and I can't seem to get anything to crossover in AS3.
Here's my code:
import com.greensock.TweenMax;
import flash.display.MovieClip;
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf"); // in this case both SWFs are in the same folder
myLoader.load(url); // load the SWF file
panel2.addChild(myLoader); // add that instance to the display list, adding it to the Stage at 0,0
panel2 = myLoader.content as MovieClip;
photo_about.alpha = 0;
photo_downloads.alpha = 0;
//panel2.content_about.alpha = 0;
//panel2.content_downloads.alpha = 0;
function closeSection():void
panel2.controlsMC.forcePause();
TweenMax.to(photo_about, .5, {alpha:0});
TweenMax.to(photo_downloads, .5, {alpha:0});
TweenMax.to(photo_home, .5, {alpha:0});
TweenMax.to(panel2.content_about, .5, {alpha:0});
TweenMax.to(panel2.content_downloads, .5, {alpha:0});
TweenMax.to(panel2.controlsMC, .5, {autoAlpha:0});
TweenMax.to(panel2.content_home, .5, {alpha:0});
panel2 traces null and all the clips loaded within pull up undefined property errors.
Can somebody please tell me what I'm doing wrong? I'd be stoked to know what I'm missing and feel like this should be a piece of cake.
Thanks for any help!You are not adding the content to the stage at 0,0, you are adding it to panel2 at 0,0. THen you take panel2 and assign it to be something that likely doesn't exist by the time you assign it. You need to wait until the loader completes loading before you attempt to do anything with its content, otherwise it has no content (null). Similarly, you cannot control anything in the loaded swf until it has finished loading. So assign an event listener to the contentLoaderInfo property of the Loader to determine when loading is complete, and have the event handler function deal with starting the interaction with it.
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf");
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, processLoadedSWF);
myLoader.load(url);
function processLoadedSWF(evt:Event):void {
// deal with the loaded swf here
// but you don't want to be assigning it to the panel2 object that contains the loader
As far as controlling anything inside the swf you load, is it an AS1/2 or an AS3 swf? -
Loading swf into movieclip object
I am trying to load a swf file into a movieclip object on the
stage. The movieclip object is sized smaller than the screen, and
placed in the middle. I have defined a loader with:
var myMovieClipLoader:MovieClipLoader = new
MovieClipLoader();
then use it like this:
_level0.myMovieClipLoader.loadClip("moviename.swf",
_level5.movieclipinstancename);
(the movieclip object is used in a swf loaded in level5)
When I load the swf like this, the swf loads at the correct
location according to where I have placed the movieclip object,
however it "blows up" to fill the screen from that point down and
across, ignoring the size of the movie clip object (the loading swf
actually expands beyond it's created size to fill the screen,
making all the graphics and text much larger than intended). The
actual pixel size of the swf I'm trying to load matches the size of
the movieclip object (1024x350 in a 1280x1024 screen).
What is the magic setting or property that will tell the
loading swf to honor the size of the movieclip object I'm loading
into?
Thanks for your help!
BarbSomething I've been working on:
Place the following code in a new file <your project
folder>\as\MovieContainer.as
Then open the properties for the symbol you want to be your
movie container
Set the AS 2.0 Class to as.MovieContainer and give it a name
(I named mine 'loader').
To load the movie, simply call:
loader.queueSWF('my.swf');
Hope that makes sense. Basically, it's just a self contained
class for loading into an object on the scene. It draws a simple
progress bar on the center of the symbol when it's loading and it
resizes the loaded object on init to conform to the size of the
object on the stage. Why queueSWF? Well, if it's currently loading
a SWF, it will wait till it's finished and load a new one. The
biggest problem right now is the progress bar, but it's fairly easy
to remove if you don't like it. Hopefully it helps.
If anyone else is reading this. I'm trying to figure out if I
can load these movies into an array of movieclips. So far I've had
no luck. If you know of a way, feel free to drop some input. -
Keep imported SWF on top across scenes
Hi,
I have made a flash game using scenes, and am trying to get sound to play across all scenes. I have so far made an external SWF and imported this into the first frame of the first scene. This works as expected, and the sound continues throughout the game. The sound can also be controlled across all other scenes, however the button itself is not visible as it is underneath all of the other content in the scene (hiding all layers allows the button to be seen)
How can I get the button to stay on top through the whole game?
Here is the code used to import the sound file:
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
function startLoad()
var SoundLoader:Loader = new Loader();
stage.addChild(SoundLoader);
var url:URLRequest = new URLRequest("sound.swf");
SoundLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
SoundLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
SoundLoader.load(url);
function onCompleteHandler(loadEvent:Event)
addChild(loadEvent.currentTarget.content);
function onProgressHandler(mProgress:ProgressEvent) {}
startLoad();
P.S. Before anyone tells me not to use scenes, I know not to in future but it is a bit late nowyou need to make SoundLoader not-local to startLoad:
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
var SoundLoader:Loader = new Loader();
function startLoad()
addChild(SoundLoader);
var url:URLRequest = new URLRequest("sound.swf");
//SoundLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
//SoundLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRES S, onProgressHandler);
SoundLoader.load(url);
function onCompleteHandler(loadEvent:Event)
addChild(loadEvent.currentTarget.content);
function onProgressHandler(mProgress:ProgressEvent) {}
startLoad();
any time other objects are added above SoundLouder and you want SoundLouder moved above, re-apply:
addChild(SoundLoader)
Maybe you are looking for
-
Dear Friends, I usally receive stock through a transporter from a vendor. If i want to make payment to this transporter on behalf of vendor(say Down payment to vendor), how can i make this? can i make this paymnet through A.P.P? what are the entries
-
Cost Estimates - system collects planed price for some raw materials only
Hello I have a question regarding price determination for raw materials when creating cost estimates. My costing variant uses material future price (Accounting 1 view) in raw materials as a primary source for price collecting of raw materials and I w
-
Maverick problem with screen display
I have installed maverick how can uninstall it as the the display is far too small i can hardly read the menus
-
Need a help in pl/sql cursors
Hi, wrong posted...if i have any clarifications i can mail to all. thanks...
-
Hi , In SCOM 2012 R2 console if i look at all of my agent managed servers have agent builds of 7.1.10184 but my two service manager servers have agent builds of 6.1.7221.49 Can anyone let me know is this known issue or how can we upgrade the agent