External swf path problem
Hi there,
I've just added some external swf.'s to my site which contain
various slideshows and galleries which now don't work at all. I
understand that all the paths in my external swf.'s containing
_root will assume that the main timeline is now the _root movie, so
I wondered if there might be a quicker way of correcting all the
paths without having to go through each one individually as there
are literally hundreds!
Any help would be greatly appreciated. Many thanks.
Hey batchas07,
Thanks for getting back to me. Erm, I'm pretty new to flash,
(the actionscript side of it anyway), so I didn't really follow
your first solution. I'm currently using Flash MX so would that
still work?
I read somewhere else to try the 'this._lockroot = true;'
script in the first frame of my external swfs. but this doesn't
seem to have done the trick either?
To give you a bit more of an idea, I'm building a site which
has five links at the bottom of the stage which each take you to a
different container movie clip, (each with an instance name of
'holder'), which each of the external swfs load in to. I'm using
the (loadMovie("external.swf", "holder") ) method of getting the
movies. All the movies load in fine, but as some of them are
slideshows with movie clips inside them I'm guessing their paths
will all be wrong which is why they don't work. The only way I have
managed to make the main movie recognize the external swfs is to
add 'holder.' after '_root.' to all the paths to buttons and movie
clips in these external swfs, but doing this to all of them will
take a long time.
Really not sure why the 'this._lockroot = true' method isn't
working out for me???
Thanks again for the help.
Similar Messages
-
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. -
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 -
Fully loaded and rendered external SWF printing problem.
I have an application that loads external SWF files that I have not built and do not have the codebase for.
I need to know when these SWFs are fully loaded and have rendered themselves on the screen.
Even gone to the point of giving them 80 enter frame events before trying to print and they show up on the paper sporadically.
Does anyone know if there's some standard event coming from some object internal to SWFLoader that would let me know when the SWF is "running?"There is no way to know in the general case. If it had an animation of
birds flying around on it, when would be the right time to print it? -
External SWF currentframe : Problem
I have a movieclip that loads and plays an external SWF into it.
Is there anyway to know the current frame number of the external swf so that I can use it to drag the movie progress bar.
Note: I cannot edit the external swf's. They are just simple and static movies.
It's urgent, please help.
Thanksyou can determine the current frame of any timeline in the external swf. for example, if you want to know the current frame of the main timeline and you're using as2, use:
targetMC._currentframe; // where targetMC is the movieclip into which your external swf was loaded.
in as3:
MovieClip(ldr.content).currrentFrame; // where ldr is the loader that loaded your external swf. -
Linking to an external swf file problem
I have one flash presentation which contains a movie clip
button with all three events (onRelease, onRollOut and onRollOver)
which links to a video which is contained in another swf. The
button appears to be temperamental with the onRelease event. It
will work sometimes and only when the browser is opened before
hand. If its not the browser just opens with a blank screen. Both
swfs are in the same directory and the onRelease event.
I have tried IE and firefox.
Any ideas are appreciated.
p.s The AS uses a getURL syntaxHi,
I'm the author of the article you pointed out. I'm sincerely
sorry that you found the solution code difficult to understand.
As kglad suggests, the problem is based on how Firefox
handles the url that Flash Player gives to it. (Although you're
using a relative url, behind the scenes Flash Player turns it into
an absolute url, one that starts with "file:///c|/..." or something
like that. (Firefox chokes on the pipe "|" character, even though
it shouldn't.) The workaround code in my article just constructs an
absolute url for you (using a colon ":" in place of the pipe
character, as in "file:///c:/..."). When you pass the absolute url
to the getURL() function, Flash Player passes it along to the
browser unmodified, so Firefox gets it with a colon and doesn't
choke.
I hope that helps make things clearer.
-Paul
H. Paul Robertson
ActionScript Developer/Writer
Platform Developer Documentation
Adobe Systems, Inc.
http://probertson.com/ -
I've got some existing swf movie that i want to load into a
another swf as external swf. my problem is that these existing swf
doesn't have stop() at the end of the movie, it plays in a loop.
but i want only want it play once per button release, what should i
do.Ok I followed your instructions and when I play the main swf
(I call - load_swfs) file it plays part1.swf fine but then it gets
to the first frame of part2.swf (which is blank) and just stops and
doesn't go any farther! Did I put something in the wrong place?
I've written what I did and where below.
// In my main file (load_swfs) it's just a single blank frame
with this code in it :-
tl=this;
swfA=["part1.swf","part2.swf","part3.swf"];
dep=0;
numLoaded = 0;
totalLoad=3;
lo=new Object();
lo.onLoadInit=function(target){
numLoaded++;
checkIfAllLoaded();
function checkIfAllLoaded(){
if(numLoaded==totalLoad){
holder1.play();
} else {
mc=this.createEmptyMovieClip("holder"+(numLoaded+1),dep++);
mcl.loadClip(swfA[numLoaded],mc);
mcl=new MovieClipLoader();
mcl.addListener(lo);
mc=this.createEmptyMovieClip("holder"+(numLoaded+1),dep++);
mcl.loadClip(swfA[numLoaded],mc);
// In part1.swf in the last frame is :-
tl.holder2.play();
this.removeMovieClip();
// In part2.swf frame 1 is blank with a stop(); and in the
last frame is:-
tl.holder3.play();
this.removeMovieClip();
// In part3.swf frame 1 is blank with a stop();
Let me know where I went wrong!
Thanks -
Target paths in external SWF's?
Hi, Im having problems with a flash based website that I am
creating. It is essentially a gallery, using a shell file for all
the navigation with external .swf's being loaded in for each image
set to keep the overall file size low. I have it all working fine
except for one weird problem, within the external .swf's there is
another layer of navigation to move forwards and backwards through
the main timeline.. it works fine as an individual .swf but when
loaded inside the shell interface none of the buttons work.
The only thing I can think of is that the paths are wrong
when it is loaded into another file, for example: does "on
(release) { _root.play();" on a button inside the external swf
refer to the root of the external file or the root of the shell swf
itself? What path am i suposed ot use to refer to items on the main
timeline of an external .swf file?
I may not have explained this very clearly, but I would be
extremely greatful for any insights, thanks for your timeyes scott, the _root in this case refers to the main movie..
try using the "on(release) {this.play()}" or
on(release){_root._LEVEL##.play()}
where ## is the level Number that the external swf is loaded
into.. -
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 -
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"); -
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.
Maybe you are looking for
-
.Mac won't send email from iphone
This used to work, but lately when I try to email a picture (taken with the iphone camera), from my .mac account on the iphone, it won't send. Just tested it without a picture, IE sending jsut a text email and it won't do that either. Any suggestions
-
My ipod touch is not showing in itunes therefore, not syncing. I've gone through the trouble shooting steps about 5 times.
-
I use a software called Cricut Craft Room. Once 8.1 was added to computer I no longer can use it. Upon trying to reinstall CCR I get Adobe error #0, and I cannot re-install. CCR uses Adobe AIR to install and run.
-
Prompt performance and Constrain problem
Hi All, I am facing a performance issue in the report prompts. For a report i have week start date and week end date and i constrain them in the prompt.So,it fetches only one week end date for a start date. but the requirement is to see all the week
-
News Iview insert more picture
Can News Iview allowed to insert more than 1 pictures in portal? Our company's New Iview only allows us to insert ONE pic, but our users do have the need to insert more than just one. Is there any way out? What should I do?