External SWF problems
i have a few SWF files loading into the main SWF. I am using
a blank movie clip to load the external SWFs.
loadMovie("photos-color.swf", "color");
That is actionscript I use to load the external SWF into the
main SWF.
I go to one page on my site, download the external SWF, then
go to another page and when I go back to the first page, it reloads
the SWF again. Just a pain in the ***.
What do I have to add to that to tell the file not to reload
once it has already been loaded?
I have been searching all over and asking around and haven't
found any answers. I've looked into listeners, is that the right
direction at least?
Thanks in advance for any help.
jesse
ok so this is what i have.
SCENES- (the dashed are the sub-categories)
home
design
-graphic
-web
-type
-drawings
photos
-color
-b/w
links
in the COLOR scene, i have an animation that drops down and
shows the area where the photos will load. in that movie clip of
the dropdown area, i have the script that calls for the external
SWF.
loadMovie("photos-color.swf", "color");
then it loads the movie and shows the clip of the pictures
and works fine for what i want it to do.
but if i click on B/W, then return to COLOR, the whole
downloading starts again.
i hope that explains it better.
All i really want to have happen is to have the file download
the first time and when revisited, just open up as if it were just
placed there.
I am hoping explaining the layout might help.
Similar Messages
-
AS3 load external swf problem, please help...
Hey guys, I am really in need of an answer here. I would tremendously grateful if someone has the answer. I'll keep it simple and right to the point:
1. I have created "index.swf" in AS3. Has it's own "MainClass" class.
2. I created "holder.swf" which is the main landing page. Has 2 buttons, for the viewer to load the site in fullscreen or standard.
3. In the timeline of "holder.swf" I have created 2 frames, 1st frame containing the buttons, second frame containing the AS3 external swf loader script.
It does not seem to want to load my "index.swf".
I have tested a million different ways, it load other swf's just fine, AS2 and AS3, but for some strange reason it just will NOT load "index.swf".
This is driving me crazy, I have a feeling it has something to do with a class conflict. I have tried (import MainClass;) in the first frame of "holder.swf" and no luck.
PLEASE GUYS, LET ME KNOW IF YOU KNOW THE ANSWER!
THANK YOU SO MUCHO.
MichaelHey kglad,
Thanks for the quick reply!
Well here is the problem... With the exception of a few things I need to update, as well as implementing some better preloaders etc... the site is running alright...
About a week ago I decided that I wanted to site to start with the above landing page. A simple "holder.swf" which would give the viewer something to look at before entering the site... (ideally I want to find a script that will begin loading "index.swf" while the viewer is still on "holder.swf", but I'll figure that out later).
Anyhow, I created "holder.swf" as I have many times before, and for some reason it does not seem to want to load "index.swf" into the second frame when instructed to do so... does that make sense?
So... ideally I would like the site to start on the above graphic, then once the button is clicked, "index.swf" opens up...
It's driving me crazy, because my code works on other swf's I've tested it with, just not with index.swf, which leads me to believe there is something in the MainClass.as file which is causing it not to load...
What are your thoughts?
Oh, and many thanks again!!!
M -
Transition_Manager and unloading external swf problems
Hi there
I´m having a few problems with my project which i although it work it has some unpleasant bugs that i´m trying to solve for days.
When i load external swf´s they show up on top of the Menu button.Maybe because the button i´m pressing is inside the same movieclip as the Menu.
Explaining better here´s a little diagram of my site:
con2 MC (Instance of Menu) ---> cont3 MC (Instance of subMenu) and mainButton MC (Instance of Main)
Here´s the general code which is inside the Painel.as
package {
import com.greensock.TweenLite;
import com.greensock.TweenMax;
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.*;
import flash.events.*;
import flash.display.MovieClip;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
public class Painel3 extends MovieClip
private var inFocus:MovieClip;
public function Painel3():void
setupClips();
addEventListener(Event.ENTER_FRAME, loop);
private function setupClips():void
con2.mainButton.addEventListener(MouseEvent.ROLL_OVER, onOver);
con2.mainButton.addEventListener(MouseEvent.ROLL_OUT, onOut);
con2.mainButton.addEventListener(MouseEvent.CLICK, onClick);
var len:int = con2.cont3.numChildren;
for(var i:int=0; i<len; i++)
var mc:MovieClip = MovieClip(con2.cont3.getChildAt(i));
mc.buttonMode = true;
mc.loc = [mc.x, mc.y];
mc.addEventListener(MouseEvent.CLICK, onClick);
con2.cont3.visible = false;
private function onOver(e:MouseEvent):void
private function onOut(e:MouseEvent):void
private function onClick(e:MouseEvent):void
con2.cont3.visible = true;
TransitionManager.start(con2.cont3, {type:Wipe, direction:Transition.IN, duration:1, easing:None.easeNone, startPoint:5} );
private function loop(e:Event):void
var distx:Number = mouseX / 1400;
var disty:Number = mouseY / 1400;
TweenLite.to(con2, 2, {
rotationY:(-70 +(145*distx)),
rotationX:(70 -(145*disty)),
ease:Expo.easeOut
And then inside the subMenu.as class for the movieclip subMenu i have the buttons that load the external swf´s:
package {
import com.greensock.TweenLite;
import com.greensock.TweenMax;
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.*;
import flash.events.*;
import flash.display.MovieClip;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
import fl.transitions.*;
import fl.transitions.easing.*;
public class subMenu extends MovieClip {
public function subMenu() {
// constructor code
menu1.buttonMode = true;
menu2.buttonMode = true;
menu3.buttonMode = true;
menu4.buttonMode = true;
menu1.addEventListener(MouseEvent.CLICK,link1);
menu2.addEventListener(MouseEvent.CLICK,link2);
menu3.addEventListener(MouseEvent.CLICK,link3);
menu4.addEventListener(MouseEvent.CLICK,link4);
function link1(e:MouseEvent) {
function startLoad()
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("AugmentedReality_v1.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
function onCompleteHandler(e:Event):void {
var swf:DisplayObject = e.target.content;
swf.x = -400;
swf.y = -300;
addChild(swf);
function onProgressHandler(mProgress:ProgressEvent)
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
startLoad();
function link2(e:MouseEvent) {
function startLoad()
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("Fotos.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
function onCompleteHandler(e:Event):void {
var swf:DisplayObject = e.target.content;
swf.x = -400;
swf.y = -300;
addChild(swf);
function onProgressHandler(mProgress:ProgressEvent)
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
startLoad();
function link3(e:MouseEvent) {
function link4(e:MouseEvent){
function startLoad()
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("Texto.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
function onCompleteHandler(e:Event):void {
var swf:DisplayObject = e.target.content;
swf.x = -400;
swf.y = -300;
addChild(swf);
function onProgressHandler(mProgress:ProgressEvent)
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
startLoad();
Like i said the swf´s show up on top of the Menu and i need it to dissapear.
Also i want to unload the swf currently in scene so that when i load another one they don´t pile on top of each other.
Pls help. ThanksOh btw, i´m having an error 1069 Property TransitionManager not found in subMenu and there is no default value
at fl.transitions::TransitionManager$/start()
at Painel3/onClick()
This doesn´t happen when i uncheck the Export for actionscript in the subMenu class but i can´t do that or else the buttons wont work. -
Loading External SWF - Problem
Hi,
Using MovieClipLoader I want to load external SWFs - and it
is working fine
if external swf doesn't have anything outside it's stage,
otherwise it shows
everything - that's the problem.
For example, external swf's stage dimensions are 100x150, but
it has some
timeline animation (some objects scrolling through the stage,
some bouncing
text animation that sometimes goes off-stage, etc..).
So when I load this external movie (banner.swf), I can see
all these objects
that were bouncing outside this 100x150 area (the stage of
banner). Even
more - the size of loaded movie is larger than 100x150px
(because of these
off-stage objects that are now visible). This way I'm getting
positioning
problems, too.
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.loadClip("banner.swf", holder);
mcl.addListener(listener);
holder._x = Stage.width/2 - holder._width/2;
holder._y = Stage.height/2 - holder._height/2;
Thanks in advance,
B.Hi kglad,
Does doing that takes only into account width and height of the stage, or also considers off stage items (as in the initial question)?
I am also looking at this issue and we can't have all the content providers modify their pre-existing flash applications to be displayed in the appropiate scale. We are looking to any of the following:
find a way to get adobe air/flash to not consider the off stage elements on the width/height we set to the movie.
find a way to get the stage size from the external movie and use that to auto calculate the resize needed.
any other alternative that allows to have the same end result, which is loading up the external content at the size we specify and displaying well. We can actually hide content outside the stage, but we still need to know the appropiate scale / size to apply to the movie so what's visible matches the are where we want to show the content. -
Unloading external swf problem - deadline approaching
Hi,
We bought a component, and the developers are not real
helpful so I thought I would try here. We have the well-known AS 3
problem of events continuing to run even after you've unloaded a
swf. Here is what we got:
a main swf loads one of 7 secondary swfs, based on a button
click. each of the secondary swfs contains the component (a 3D
wall) that we purchased. we don't seem to have access to the code.
we unload one swf load the next, and then after we do this a few
times we get the following crash (output way below).
The component does have a closeWall() function, which i'm
assuming cleans things up. The problem is I don't know how to call
a function on an externally loaded swf? Is that possible? In other
words I want to say:
var loader:Loader;
function loadSwf(){
loader = new Loader();
var urlRequest:URLRequest = new URLRequest ("vidSub.swf");
loader.load(urlRequest);
addChildAt(loader, getChildIndex(holder));
function unloadSwf(){
// hey swf, close properly, before I unload you
loader.closeWall();//or something like this
loader.unload();
Thanks so much if you can help.
Doug
Crash output:
Error: Error #2094: Event dispatch recursion overflow.
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.display::Stage/dispatchEvent()
at
org.papervision3d.core.utils.virtualmouse::VirtualMouse/::handleUpdate()
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at
org.papervision3d.core.utils.virtualmouse::VirtualMouse/update()
at
org.papervision3d.core.utils.virtualmouse::VirtualMouse/setLocation()
at
org.papervision3d.core.utils::InteractiveSceneManager/org.papervision3d.core.utils:Intera ctiveSceneManager::handleMouseMove()
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.display::Stage/dispatchEvent()
at org.papervisionI feel for you...
You may want to try to instantiate the thing not through
adding loader to display list but accessing application domain and
creating an instance of its class. Some application will not do a
thing if you just add them to display list and accessing their
interfaces (I love doing that for one :-). In any case - I am not
sure it is such a good idea to add the loader directly - not within
INIT event listener.
You may want to try accessing their application domain and
loop through its properties to see which ones are enumerable. In
the error stack you can see some their classes so you know already
what to access. For instance there is
org.papervision3d.core.utils.InteractiveSceneManager class.
I don't say anything new but it looks like there is the same
event flying around which is dispatched by some listener causing
recursion. Can it be that your custom events have the same type as
theirs? Try to listen to their events through making listener
listen in capture phase by setting third parameter to true:
blah.addEventListener("eventType", eventHandler, true) - you may be
able to explicitly remove their event listener if you know which
one. Or, perhaps, this is your mouse event that conflicts with
theirs...
Sorry I cannot be more helpful. -
iv recently started learning as3 and have made a flash site
using it which all works fine. iv used an online tutorial to help
create a dynamic slideshow/photo gallery which again works fine.
But when i try to load the external slideshow/gallery into a
movieclip it dosnt work and i get this error:
TypeError: Error #1009: Cannot access a property or method of a
null object reference.
im pretty sure its because the code used in the main flash
file is on the timeline and the code in the external file to be
loaded in is in an external as file.
any suggestions on a way around this?
the code im using to load the external flash file is:
toload.load(new URLRequest("newfile.swf"));
photography.buttonThumb.addChild(toload);no sorry forgot the 1st line
var toload =new Loader();
the loader works fine when loading jpegs and swfs with no
actionscript -
Loading an external swf problem
Hi everyone,
I have started a new project for a client that wants a
shopping cart that works through PayPal in his flash site. I have a
working shopping cart at
http://www.flypapercreative.com/flashshop.html
. Some things need to changed but it is working.
I am using the code below to load the shopping cart into my
main movie. I have made an empty movie and gave it an instance name
of "myContainer" and set it up in my time line. You can find my
main flash movie at
http://flypapercreative.com/olc.html
myContainer.loadMovie("oregonLoveCoStore.swf");
Both carts are reading off the same swf file. This is just a
guess but maybe it is not reading code or instance names that are
not on the main timeline.
Anyone know a different way to load my shopping cart swf file
differently that might fix the problem?
Thanks,
Chrisuse the MovieClipLoader class. F1 for help docs in
Flash. -
Problem with volume handle and external SWF
Hello I'm having 2 problems.
The first is that when loading an external swf in my main SWF I get this in the output window:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at audio_fla::list_1/frame1()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at audio_fla::MainTimeline()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at audio_fla::MainTimeline/frame1()
But it still works. Its an mp3 player.
The other problem is that the loaded SWF has a volume controller. When I test the external SWF by itself it works fine. When I load it on my main SWF when I start to drag the handle on my volume slider and MOUSE_UP outside the handle it still keep dragging the handle.
The code of my main SWF is:
import caurina.transitions.*;
var _currentCategory:String = "";
var percent:String = "";
var loader = new Loader();
loader.name="videoLoader";
loadermc.visible=false;
cat.addEventListener(MouseEvent.MOUSE_OVER, onOverCat);
cat.addEventListener(MouseEvent.MOUSE_OUT, onOutCat);
cat.addEventListener(MouseEvent.CLICK, onClickCat);
btnback.addEventListener(MouseEvent.MOUSE_OVER, onOverCat);
btnback.addEventListener(MouseEvent.MOUSE_OUT, onOutCat);
btnback.addEventListener(MouseEvent.CLICK, onClickBack);
cat.buttonMode = true;
btnback.buttonMode = false;
btnback.visible = false;
function onOverCat(e:MouseEvent):void{
Tweener.addTween(e.target, {alpha:.5 , time:.5});
function onOutCat(e:MouseEvent):void{
Tweener.addTween(e.target, {alpha:.25 , time:.5});
function onClickBack(e:MouseEvent):void{
loader.unloadAndStop();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
lcontent.visible = false;
cat.visible = true;
Tweener.addTween(cat, {alpha:1, time:1});
btnback.buttonMode = false;
btnback.visible = false;
cat.buttonMode = true;
toptxt.text = "SELECCIONE UNA CATEGORIA"
function onClickCat(e:MouseEvent):void{
lcontent.visible=true;
cat.buttonMode = false;
Tweener.addTween(cat, {alpha:0, time:1, onComplete:function(){
cat.visible = false;
btnback.buttonMode = true;
btnback.visible = true;
loaderTweenIn(e.target.name);
function loaderTweenIn (c:String):void{
var category:String = c+".swf";
trace(category);
loader.load(new URLRequest(category));
loader.contentLoaderInfo.addEventListener (Event.COMPLETE, movieLoaded);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, movieProgress);
function ioErrorHandler(e:IOErrorEvent):void{
trace("ioErrorHanlder: "+e);
function movieLoaded(e:Event):void{
trace("The movie has loaded");
lcontent.addChild(loader);
loadermc.visible=false;
function movieProgress(e:ProgressEvent):void{
loadermc.visible = true;
// percent=String(Math.floor(e.bytesLoaded / e.bytesTotal * 100)) + "%";
trace("The movie is loading "+Math.floor(e.bytesLoaded / e.bytesTotal * 100));
The code on my external SWF is:
import caurina.transitions.*;
volume_mc.slider_mc.buttonMode = true;
var myXML:XML;
var thb:Thbs;
var myThumbs:XMLList;
var totalThumbs:Number;
var thumbHeight:Number=50;
var i:uint = 0;
var preloader:LoaderAnim;
var yCounter:Number = 0;
var container:MovieClip;
var musicReq:URLRequest;
var music:Sound = new Sound();
var sc:SoundChannel;
var currentSound:Sound = music;
var pos:Number;
var songPlaying:Boolean = false;
var songlist:XMLList;
var currentIndex:Number = 0;
mc_sound.mute.visible=false;
var xmlLoader:URLLoader = new URLLoader();
///////////////////////////PLAYLIST//////////////////
function initMediaPlayer(e:Event):void{
myXML = new XML(xmlLoader.data);
myThumbs = myXML.*;
totalThumbs = myThumbs.length();
trace("The total thumbs are "+totalThumbs);
createContainer();
callThumbs();
xmlLoader.load(new URLRequest("audio.xml"));
function createContainer():void{
container = new MovieClip();
list.ch.addChild(container);
container.y = 0;
container.x = 0;
container.buttonMode = true;
function onOver(e:MouseEvent):void{
var t:Loader = Loader(e.target);
Tweener.addTween(t, {alpha:.5, time:1});
function onOut(e:MouseEvent):void{
var t:Loader = Loader(e.target);
Tweener.addTween(t, {alpha:1, time:1});
function callThumbs():void{
var thumbURL = myThumbs[i].@thumb;
var thumbTitle:String = myThumbs[i].@title;
var thumbDesc:String = myThumbs[i];
trace("Loading "+thumbURL);
trace("Title "+thumbTitle);
trace("Desc "+thumbDesc);
var thumbLoader = new Loader();
thumbLoader.load(new URLRequest(thumbURL));
thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumbLoader.name=i;
thumbLoader.x=5;
thumbLoader.y=5;
thb = new Thbs();
container.addChild(thb);
thb.thb_title.htmlText = thumbTitle;
thb.thb_desc.autoSize = TextFieldAutoSize.LEFT;
thb.thb_desc.htmlText = thumbDesc;
thb.y = (thumbHeight+2)*yCounter;
preloader = new LoaderAnim();
preloader.x = thb.x + 20;
preloader.y = thb.y+ 20;
container.addChild(preloader);
yCounter++;
function thumbLoaded(e:Event):void{
var thbx:Loader = Loader(e.target.loader);
thb.addChild(thbx);
thbx.addEventListener(MouseEvent.MOUSE_OVER, onOver);
thbx.addEventListener(MouseEvent.MOUSE_OUT, onOut);
container.removeChild(preloader);
i++;
if (i<totalThumbs){
callThumbs();
if (i==totalThumbs){
startAudio();
xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
///////////////////////////////////////AUDIO//////////////////////////
function startAudio():void{
songlist = myXML.*;;//this is the same as myXML.*;
trace("This is the first song "+songlist[0].@song);
musicReq = new URLRequest(songlist[0].@song);
music.load(musicReq);
sc = music.play();
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
next_btn.addEventListener(MouseEvent.CLICK, nextSong);
prev_btn.addEventListener(MouseEvent.CLICK, prevSong);
pause_btn.addEventListener(MouseEvent.CLICK,pauseSong);
stop_btn.addEventListener(MouseEvent.CLICK,stopSong);
function nextSong(e:Event):void
if (currentIndex < (songlist.length() - 1))
currentIndex++;
else
currentIndex = 0;
var nextReq:URLRequest = new URLRequest(songlist[currentIndex].@song);
var nextTitle:Sound = new Sound(nextReq);
sc.stop();
sc = nextTitle.play();
songPlaying = true;
currentSound = nextTitle;
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
function prevSong(e:Event):void
if (currentIndex > 0)
currentIndex--;
else
currentIndex = songlist.length() - 1;
var nextReq:URLRequest = new URLRequest(songlist[currentIndex].@song);
var prevTitle:Sound = new Sound(nextReq);
sc.stop();
sc = prevTitle.play();
songPlaying = true;
currentSound = prevTitle;
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
function pauseSong(e:Event):void
pos = sc.position;
sc.stop();
songPlaying = false;
play_btn.addEventListener(MouseEvent.CLICK,playSong);
function playSong(e:Event):void
if(songPlaying == false)
sc = currentSound.play(pos);
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
songPlaying = true;
play_btn.removeEventListener(MouseEvent.CLICK,playSong);
function stopSong(e:Event):void
sc.stop();
pos = 0;
songPlaying = false;
play_btn.addEventListener(MouseEvent.CLICK,playSong);
///////////////////////////////VOLUME/////////////////////////////
var xOffset:Number;
var xMin:Number = 0;
var xMax:Number = volume_mc.track.width;
volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_DOWN, sliderDown);
volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_UP, sliderUp);
stage.addEventListener(MouseEvent.MOUSE_UP, sliderUp);
function sliderDown(e:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, sliderMove);
xOffset = mouseX - volume_mc.slider_mc.x;
function sliderUp(e:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, sliderMove);
function sliderMove(e:MouseEvent):void{
volume_mc.slider_mc.x = mouseX - xOffset;
if(volume_mc.slider_mc.x<=xMin){
volume_mc.slider_mc.x = xMin;
if(volume_mc.slider_mc.x>=xMax){
volume_mc.slider_mc.x = xMax;
var vol:Number = volume_mc.slider_mc.x*.01;
var st:SoundTransform = new SoundTransform(vol,0);
sc.soundTransform = st;
trace("The volume is "+vol);
if(vol==0){
mc_sound.mute.visible=true;
}else{
mc_sound.mute.visible=false;
e.updateAfterEvent();I found the solution.
-
AS3 Unloading external SWF piling up problem
I have two buttons on main SWF what loads and Unload two external SWFs back and forth.
Also one timer function is calling external Screen saver SWF and unload the existing one when no interaction found.
I am using unloadAndStop() function to unload the external SWFs.
But after loading and unloading external SWFs, I am facing piling up or stack overflow problem.
Any help will be highly appreciated.
Thanks
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Video;
import flash.display.MovieClip;
import caurina.transitions.*;
import flash.utils.Timer;
import flash.events.*;
var myLoader_Map_1:Loader = new Loader();
var myLoader_Map_2:Loader = new Loader();
var myLoader_Screen_Saver:Loader = new Loader();
var Ss:Boolean = false;
var Maps:Boolean = true;
//--------------------Screen Saver---------------------------------
ScreenSaver();
function ScreenSaver():void{
var url:URLRequest = new URLRequest("screensaver.swf");
myLoader_Screen_Saver.load(url);
addChild(myLoader_Screen_Saver);
setChildIndex(myLoader_Screen_Saver, 1);
Maps = false;
Ss = true;
function ScreenSaver_Unload():void{
myLoader_Screen_Saver.unloadAndStop();
//--------------------Map Buttons---------------------------------
function MPstart():void{
Tweener.addTween(MC_Maps_Btns,{alpha:1, x:778.25, y:1070.65, time:1, delay:1, transition:"easeOutCubic"});
setChildIndex(MC_Maps_Btns, 2);
MC_Maps_Btns.Btn_Map_1.visible = true;
MC_Maps_Btns.Btn_Map_2.visible = true;
function MPclose():void{
Tweener.addTween(MC_Maps_Btns,{alpha:0, x:778.25, y:1179.85, time:1, transition:"easeOutCubic"});
//--------------------Map 1 ---------------------------------
MC_Maps_Btns.Btn_Map_1.addEventListener(MouseEvent.CLICK,OpenMap1);
function OpenMap1(e:MouseEvent):void{
var url:URLRequest = new URLRequest("Map_1.swf");
myLoader_Map_1.load(url);
myLoader_Map_1.alpha = 1;
addChild(myLoader_Map_1);
setChildIndex(myLoader_Map_1, 2);
myLoader_Map_2.unloadAndStop();
ScreenSaver_Unload();
Maps = true;
Ss = false;
MC_Maps_Btns.Btn_Map_1.visible = false;
MC_Maps_Btns.Btn_Map_2.visible = true;
//--------------------Map 1 ---------------------------------
MC_Maps_Btns.Btn_Map_2.addEventListener(MouseEvent.CLICK,OpenMap2);
function OpenMap2(e:MouseEvent):void {
var url:URLRequest = new URLRequest("Map_2.swf");
myLoader_Map_2.load(url);
myLoader_Map_2.alpha = 1;
addChild(myLoader_Map_2);
setChildIndex(myLoader_Map_2, 2);
myLoader_Map_1.unloadAndStop();
ScreenSaver_Unload();
Maps = true;
Ss = false;
MC_Maps_Btns.Btn_Map_2.visible = false;
MC_Maps_Btns.Btn_Map_1.visible = true;
//--------------------Timer ---------------------------------
var inactiveTime:int = 10000;
var t:Timer = new Timer(inactiveTime);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown1);
t.addEventListener(TimerEvent.TIMER, onTimer);
t.start();
function onMouseDown1(e:MouseEvent):void {
t.reset();
t.start();
trace("Interaction detected");
function onTimer(e:TimerEvent):void {
handleInactivity();
function handleInactivity():void {
trace('You\'re inactive.');
if (Maps == true){
myLoader_Map_1.unloadAndStop();
myLoader_Map_2.unloadAndStop();
else{
trace("No Maps");
if (Ss == false ){
ScreenSaver();
MPclose();
else{
trace("ScreenSaver already loaded");This is how I applied
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Video;
import flash.display.MovieClip;
import caurina.transitions.*;
import flash.utils.Timer;
import flash.events.*;
var myLoader_Map_1:Loader = new Loader();
var myLoader_Map_2:Loader = new Loader();
var myLoader_Screen_Saver:Loader = new Loader();
var Ss:Boolean = false;
var Maps:Boolean = true;
//--------------------Screen Saver---------------------------------
function unloadAllF():void{
if(myLoader_Screen_Saver.content){
myLoader_Screen_Saver.unloadAndStop();
trace("ss unloaded");
if(myLoader_Map_1.content){
myLoader_Map_1.unloadAndStop();
trace("map_1 unloaded");
if(myLoader_Map_2.content){
myLoader_Map_2.unloadAndStop();
trace("map_2 unloaded");
//etc
ScreenSaver();
function ScreenSaver():void{
var url_ss:URLRequest = new URLRequest("screensaver.swf");
unloadAllF();
myLoader_Screen_Saver.load(url_ss);
addChild(myLoader_Screen_Saver);
setChildIndex(myLoader_Screen_Saver, 1);
Maps = false;
Ss = true;
function ScreenSaver_Unload():void{
myLoader_Screen_Saver.unloadAndStop();
//--------------------Map Buttons---------------------------------
function MPstart():void{
Tweener.addTween(MC_Maps_Btns,{alpha:1, x:778.25, y:1070.65, time:1, delay:1, transition:"easeOutCubic"});
setChildIndex(MC_Maps_Btns, 2);
MC_Maps_Btns.Btn_Map_1.visible = true;
MC_Maps_Btns.Btn_Map_2.visible = true;
function MPclose():void{
Tweener.addTween(MC_Maps_Btns,{alpha:0, x:778.25, y:1179.85, time:1, transition:"easeOutCubic"});
//--------------------Map 1 ---------------------------------
MC_Maps_Btns.Btn_Map_1.addEventListener(MouseEvent.CLICK,OpenMap1);
function OpenMap1(e:MouseEvent):void{
var url_map_1:URLRequest = new URLRequest("Map_1.swf");
unloadAllF();
myLoader_Map_1.load(url_map_1);
myLoader_Map_1.alpha = 1;
addChild(myLoader_Map_1);
setChildIndex(myLoader_Map_1, 2);
myLoader_Map_2.unloadAndStop();
ScreenSaver_Unload();
Maps = true;
Ss = false;
MC_Maps_Btns.Btn_Map_1.visible = false;
MC_Maps_Btns.Btn_Map_2.visible = true;
//--------------------Map 1 ---------------------------------
MC_Maps_Btns.Btn_Map_2.addEventListener(MouseEvent.CLICK,OpenMap2);
function OpenMap2(e:MouseEvent):void {
var url_map_2:URLRequest = new URLRequest("Map_2.swf");
unloadAllF();
myLoader_Map_2.load(url_map_2);
myLoader_Map_2.alpha = 1;
addChild(myLoader_Map_2);
setChildIndex(myLoader_Map_2, 2);
myLoader_Map_1.unloadAndStop();
ScreenSaver_Unload();
Maps = true;
Ss = false;
MC_Maps_Btns.Btn_Map_2.visible = false;
MC_Maps_Btns.Btn_Map_1.visible = true;
//--------------------Timer ---------------------------------
var inactiveTime:int = 10000;
var t:Timer = new Timer(inactiveTime);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown1);
t.addEventListener(TimerEvent.TIMER, onTimer);
t.start();
function onMouseDown1(e:MouseEvent):void {
t.reset();
t.start();
trace("Interaction detected");
function onTimer(e:TimerEvent):void {
handleInactivity();
function handleInactivity():void {
trace('You\'re inactive.');
if (Maps == true){
myLoader_Map_1.unloadAndStop();
myLoader_Map_2.unloadAndStop();
else{
trace("No Maps");
if (Ss == false ){
ScreenSaver();
MPclose();
else{
trace("ScreenSaver already loaded"); -
HELP PLEASE - loading external swf scale problem
I have a Flex 3 Actionscript Project. Basically all it does it take some flash vars, set the sound volume, and load an external swf using a loader and add the loader as a child. The problem is I want the loaded external swf to be scaled to fill the entire stage, even if it distorts it, and that doesn't seem to be happening.
I really need to resolve this. ANY HELP APPRECIATED.
MarcusThanks for the reply!
Here's basically what my code looks like (note: I cut some stuff out that wasn't relevant for the sake of clarity).
private var swfLoader:Loader = null;
public function MySwfContainer()
stage.scaleMode = StageScaleMode.EXACT_FIT;
stage.align = StageAlign.TOP_LEFT;
var request:URLRequest = new URLRequest(swfUrl);
swfLoader = new Loader();
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,SWFLoader_Complete);
swfLoader.load(request);
private function SWFLoader_Complete(event:Event):void
addChild(swfLoader);
What I am observing is that if a swf larger than the stage area is loaded it clips it rather than scale it down and make it fit.
Marcus -
I can only guess if its a layer / stacking problem or not, but I have a main fla file that loads three external SWF's, all ontop of each other, three buttons for each movie, that designate that movie is the visible one playing.
It's basically a portfolio site. You can see the site here
www.tvnstudios.com/loadvis.html
Why aren't the movies playing smoothly? The FPS rate is the same for all three of the external SWF's and for the main fla that is loading them.
Can anyone help?
I'd be so grateful!
Thanks,
-T
p.s. I'm including the fla file that has the actionscript that loads the movies. It's a small code, but maybe the error is in there somewhere...If you are loading all of the files and they are all playing at the same time, that could be the problem. Invisible files still eat up their share of the processor if they are left in a playing mode.
I am unable to determine there is any slowness, primarily due to not knowing what the first one is supposed to be doing and the others appear to be flip book implementations that work fine as long as they are only the couple of pages I can see. -
Problem with Error 5005 and with external SWF loading
I am creating a relatively simple 10-12 minute animation. I've broken the animation into 34 different movie clips that I control on the timeline by using a timer delay.
When I try to export them all together I get the error:
",Line 1: Error 5005: Unknown Error optimizing byte code."
However, when I split the presentation into two halves with the same exact frames and code I don't have the problem.
I thought loading an external SWF at the end of the first movie would be a good way to connect everything. However, the SWF continuously loads and won't play through the way it looks when you open the actual SWF file.
This is my code for the external loading:
var xpos:Number = 0;
var ypos:Number = 0;
var swf:MovieClip;
var myLoader:Loader = new Loader();// create a new instance of the Loader class
var url:URLRequest = new URLRequest("aamc-2e-slide1.swf");// in this case both SWFs are in the same folder
myLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
myLoader.load(url);
function doneLoading(evt:Event):void
trace("doneloading");
swf = MovieClip(myLoader.content);
stage.addChild(swf);
swf.stop();I have the same/similar issue whether the stop is there or not.
Yes, it is all on one frame.
Without the stop, the SWF just continously loops on top of itself. -
Problem loading external swf's
Hi
I'm creating an application where the user uses the ARROW KEYS to navigate around the menus and SPACEBAR to continue.
On the first screen is the main menu that launches external swf's. (I have it as an exe)
When I play the external swfs individually in the Flash Player.......the navigation is perfect and runs smoothly.
But when I launch the external swf's through the first screen (menu).....the loaded swf becomes very slow/sluggish to react when I hit the ARROW KEYS.
(eg. have to hit the arrow key 3/4 times before it moves)
The frame rate in each fla is the exact same.
I use the levels to launch the external swf..............I have also used the "load into an empty movieclip" and the outcome is still the same.
I'm using CS5.
What could be the problem???
Thanks for your help.In the 3 external swfs, I have in each around 10 scenes. In each scene I have 6 frames with a stop() command in each frame.
On the selected button in each frame I have the following code: (using actionscript2)
on (keyPress "<Up>") {
gotoAndStop(3);
on (keyPress "<Down>") {
gotoAndStop(1);
on (keyPress "<Space>") {
gotoAndStop("scene02", "firstframeLabel");
This code is consistant through the 10 scenes.
On the menu swf; I have a menu system that launches the 3 external swf.
One scene, using 3 frames with a stop() command in each frame.
On the selected button in each frame I have the following code: (using actionscript2)
on (keyPress "<Up>") {
gotoAndStop(3);
on (keyPress "<Down>") {
gotoAndStop(1);
on (keyPress "<Space>") {
loadMovie ("application01.swf", 30); -
Problem with accessing external swf library items
Hi,
I have a really annoying problem when I try to access the library items of an external .swf file. It is something I have done many times before using the ApplicationDomain.currentDomain.getDefinition() method. In this particular exmple, however, I am trying to load a .swf file from a full web address rather than locally.
I can load in the .swf and try to set the application domain like the following
* Please note that I amu using bulkLoader
var domain:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain)
var lc:LoaderContext = new LoaderContext(false, domain);
var path:String = WorldManager.SITE_ROOT + swfPath;
l.add(path, { id:"Kit", context:lc } );
l.start();
The file loads successfully but when I try to access the .swf library assets using the following it cannot access it
domain.getDefinition("Shirt_B04");
If I load the file with a relative path it works.....
Does anyone have any ideas how I can solve this?In addition to David's reply, this technote may help:
http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WSc78c5058ca073340dcda9110b1f693f21-7e6 8a.html -
Hi,
I have an external photo gallery with a previous and next
buttons that loads into a main swf. When I test the external swf on
its own the buttons work fine. But, when I load the external swf in
the main swf the buttons work once and to make them work again you
have to move your mouse a little to make it work again. You can not
just leave your mouse over the button and just keep on clicking the
way it works when I test the swf on its own.
Is there away to make it work without moving the mouse after
each click?
Thanks in advanceHi I am using AS3
button_3.addEventListner(MouseEvent.CLICK,fl_ClickToLoadUnloadSWF_3);
var fl_Loader_3:loader;
var fl_ToLoad_3:Boolean=true;
function fl_ClickToLoadUnloadSWF_3(event:mouseEvent):void
if(fl_ToLoad_3)
fl_Loader_3 = new Loader();
fl_loader_3.load(new URLRequest("new_products.swf"));
addChild(fl_Loader_3);
else
fl_Loader_3.unload();
removeChild(fl_Loader_3);
fl_loader_3+null;
fl_TOLoad_3 =!fl_ToLoad_3;
This is the first half of the code for one button, the code for the second button is the same, just different variable names.
thanks
Maybe you are looking for
-
[Xorg] some issues with i915 and gdm
Hi all I'm having some issues starting the X server. I don't know how it happened, my netbook was on standby. After I turned it on, there were loud beep sounds coming out of my computer and the screen was completely black so I shut it down. After I t
-
Hello, I've been an 8130 Pearl user on the Telus network up here in Canada since Christmas of 2007. I am currently on my 4th Pearl and although I keep having difficulties, I do love my blackberry. 1st bb: blinking hourglass of doom. 2nd bb: the "op"
-
JOIN issue while coding the SQL
Hi, I have 3 tables called Customer, Telecom and Telecom Type. Each customer must have Home phone number and optional work phone. The Telecom table stores these numbers against a column called "Phone_Num" and uses the column Telecom_Typ_id to differe
-
Download page for old AIR versions?
I have a project that requires building for Air 1.5, so I need to build out a test environment. I can't seem to find a download location for previous versions of Air... can someone point me in the right direction? Thanks, Jay
-
DBLink From Oracle 9i server to Oracle RDB Server
Hi, i have to take access a table which is on ORACLE RDB server from Oracle 9i server... I have tried this many times......but not succeed. plz help me its very urgent.