Pause External SWF Loaded In Container Movieclip
Hi there, I have a flash movie that loads external SWFs into a container movieclip in the main movie. The actual animation frames in these external SWFs are a couple of layers down in each clip, ie: a movieclip within a movieclip within a movieclip. I need to add a pause button in the main movie that will pause the currently playing movieclip. I think the problem lies in my not referencing the movieclip properly. Click the link below to download the FLA files to see what I'm talking about!http://www.artboxgraphics.com.au/temp/ABKslideshow.zip(Main movie FLA + 2 External Clip FLAs) Ideally I would like the "pause" button to function more as a "pause/resume", but I'm happy to take things one step at a time! If anyone could show me how to do this it would be VERY much appreciated. I have burned many hours on this! Cheers, Chris
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 10-25-2006, 09:07 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Closing An External Swf That Was Loaded Into A Container? HELP
Hey all. I know that I have posted a few questions concerning this issue and im not sure if i was seeming to ignorant to help, or if my questions were simply just to vague for anyone to understand.
Heres the deal. Im tryin to close an external movie that was loaded into a container of my main movie. I have tried "unloadmovie" and "removemovieclip" and I cannot seem to make either of these scripts accomplish what i am attempting. Unloadmovie simply closes the EVERYTHING including the main movie and the removemovieclip seems to do nothing at all even though there are no errors...
if anyone can help me out with this i would really appreciate it. Thanks yall!!
External MovieClip Loads Twice Into Container MC?
Has anyone had this problem? I have a button which loads an external SWF into a container MC on my stage. Every now and then (especially when the system's resources are taxed) the external movieclip loads twice into the container, and stopping it via the "pause" control only stops the first SWF--the other goes right on playing underneath it.
Here's my code:
Code:
btn01.onRelease = function() {
container.unloadMovie();
myMCL.loadClip("assets/01.swf",container);
}
Unloading the container before loading in a new SWF made the duplication happen less often, but it still happens now and then. Does anyone have any idea what might be going on here?
Thank you in advance for your help. I'll be presenting this project tomorrow!
Preload External JPGs In Container MovieClip
I have a main movie timeline which has a container movie loaded into it with various external SWFs. These external SWFs have external JPGs associated with them which are loaded in using loadMovie. What I'd like to do is to load all the JPGs while loading the external SWF so that ALL preloading can take place at the same time. At the moment the external SWF is fully loaded and then the JPGs must be loaded afterwards.
Could anyone suggest the best way of going about this? Thanks!
Stop/Pause MovieClip In Dynamically Loaded Swf?
I have a movieclip playing within a swf that is dynamically loaded into another swf as a movieclip and I want to make a button that tells the internal swf to pause not just the main timeline (which it does now) but also pause the movieclip within the internal swf (which it isn't doing).
Is there a global movieclip stop/pause action I can use?
Here is what the pause button says now if it helps (the part in red is to stop dynamically loaded audio and works fine):
on (press) {
paused02=true
playing02=false
stopped02=false
voiceOverPosition=_root.voiceOver.position/1000;
_root.voiceOver.stop();
}
on (press) {
this._parent.placeHolder.stop();
this.gotoAndStop(2);
}
placeHolder is the name of the internal swf
thanks for the help
Pause Music When External Movie Is Loaded
Hi
I have the famous "cleoplayer" (kind of music jukebox)in the main timeline. It works fine.
But my problem arises when I load an external movie (section1.swf)with its own music, as both musics play at the same time.
What I would like to do is to fade out the music of the current track playing in the cleoplayer, and fade it in when "section1.swf" is unloaded...but I guess this is too much for me.
So, I would be glad if I even know how to pause the music while "section1" plays. That would be enough.
If it is of any help, the actions inside the "pause" button of the cleoplayer are the following:
on (release) {
if (action eq "pause") {
action = "play";
status = "playing tr. " add playtrack;
tellTarget ("tracks") {
gotoAndStop("track" add ../laytrack);
}
play();
} else {
if (action eq "play") {
action = "pause";
status = "paused tr. " add playtrack;
tellTarget ("tracks") {
gotoAndStop("stop");
}
stop();
}
}
}
I guess I should "call" this button at the same time I call "section1" to load...
on (release) {
_root.container.loadMovie("section1.swf");
}
...but I don't know how.
Can someone help me?
How To Swap Movieclip With Other Content, In A Movieclip Loaded External
Hi! I'm getting desperated.
I started about 3 days ago trying to solve this problem, maybe i'm very noob!
I have a main movie. Inside this, i load various externals swf's. One swf for a menu, another for a image presentation, etc.
In the menu, i load various instances of another swf file... a button swf, and witch one has to have a different image as button.
So inside the button, i have a layer with a button, but no shape or nothing, and in another layer, i have a movieclip to can swap by an image.
So, the struct is like this:
Main Movie
. image_presentation
. contact
. menu
. . button1
. . . button
. . . image
. . button2
. . . button
. . . image
. . button3
. . . button
. . . image
. . button4
. . . button
. . . image
So, button is only a swf file, with various instances. "button" inside the buttons, make the button efect, with a white border apearing on mouse over button. "image" is a movieclip created only for change with an image (button 1 = image 1, button 2 = image 2, etc).
How can i do this, controlling the images url's from the main movie?? I had tried a lot of ways, but i could do it.
Please help.
Thanks.
Duplicating Movieclip After External .swf Is Loaded Into It?
I have a movieclip called "textcolor" that loads an external "movie1.swf" into itself when a button is pushed -- and it works.
But when I attempt to duplicate the "textcolor" movieclip after the "movie1.swf" has loaded into it, it doesn't work. Of course I can control all other attributes about "textcolor" such as alpha and size using other buttons, why can't I duplicate it?
Here's my simple code:
---------------------
on (release) {
_root.textcolor.duplicateMovieClip("textshadow", 1);
textshadow._x = 200;
textshadow._y = 200;
}
---------------------
Is there something I'm missing here?
Much thanks,
--Chuck
http://www.letterheadfonts.com
Can't Duplicate External Loaded Movieclip
//i have two movieclips
//recipient.swf
//txt.swf
//there is the movieclip that i want to load and then duplicate
URL = ("txt.swf");
//here is the normal process to load a movieclip in actionscript using loadClip function
var NWOBJ = new MovieClipLoader();
OBJ = new Object();
OBJ.onLoadStart = function(target_mc) {
};
OBJ.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
};
OBJ.onLoadComplete = function(target_mc) {
};
OBJ.onLoadInit = function(target_mc) {
//when the object is loaded, it is supouse that i can duplicate it.
//duplicate(target_mc); //option1. See NOTE
duplicate2(); //option2. See NOTE
};
OBJ.onLoadError = function(target_mc, errorCode) {
};
NWOBJ.addListener(OBJ);
//here is where i load the movieclip
NWOBJ.loadClip(URL, top_mc.sub_mc);
//NOTE: I ALSO TRY TWO WAYS TO DUPLICATE THE OBJECT, USING THE target_mc, RETURNED FROM THE loadClip FUNCTION,
//and the second was using the instanceName of the movie where i loaded my external movieclip.
//this is the function to duplicate the movieclip, called when the object is loaded.
duplicate2 = function () {
//everything is working at now, the original movieclip was loaded and it,s visible.
for (i=0; i<=6; i++) {
top_mc.sub_mc.duplicateMovieClip(("duplicated_obje ct"+i), i);
trace(i) // 0,1,2,3,4,5,6
// set the _y position for my duplicated moviclips.
top_mc["duplicated_object"+i]._y = loaded_obj._height*i;
// set a value for the textfield "txt" into my loaded movieclip
top_mc["duplicated_object"+i].txt.text = "DUPLICATED OBJ / NUMER: " + i;
}
//well, here is where is my probelm, nothing happened, i couldn,t duplicate the movieclips. why???
// i'll appreciate any help. regards.
};
duplicate = function (loaded_obj) {
//everything is working at now, the original movieclip was loaded and it,s visible.
for (i=0; i<=6; i++) {
loaded_obj.duplicateMovieClip(("duplicated_object" +i), i);
trace(i) // 0,1,2,3,4,5,6
// set the _y position for my duplicated moviclips.
this["duplicated_object"+i]._y = loaded_obj._height*i;
// set a value for the textfield "txt" into my loaded movieclip
this["duplicated_object"+i].txt.text = "DUPLICATED OBJ / NUMER: " + i;
}
//well, here is where is my probelm, nothing happened, i couldn,t duplicate the movieclips. why???
// i'll appreciate any help. regards.
};
Problem With External Swf Loaded Into MovieClip
I have this problem, im loading external swf into a MovieClip using the Loader method, but i want to manipulate the frames inside of them, for example load a Swf as a child and tell it to go to frame 2 and stop how can i do this, because once i add it as a child it is a Object Loader not a movieClip.
Using Variables Inside A External Swf, Loaded Into Movieclip
I have the code
Code:
createEmptyMovieClip("sub_mc", 1);
sub_mc.loadMovie("sub.swf");
to load the external swf file. However, the swf file loaded above contains some variables I would like to access in the main movie. These vars are declared on the root of the sub.swf such as
var name = "this";
Writing script on the first frame of the main movie, how can I reference the vars?
I've tried
trace (_level1.name);
but I get "undefined".
Any thoughts?
cheers
Accessing Timeline Of External Swf Loaded In MovieClip
I am trying to see if loading my external swf into an empty movie clip would be more effective then loading into the Flash MX 2004 Loader component.
When using the loader I was able to access the loaded content's timeline by:
code:
_root.Loaderinstance.content.gotoAndPlay("frame label");
How do I perform this same action when using a empty movieclip rather then a Loader?
If you are aware of the advantages/disadvantages of using one over the other please let me know. Thanks a bunch all!
[F8] Help No Sound From External Swf Loaded Into Parent Swf Movieclip
I am trying to load an external swf (with a sound track) into a movie clip - clip loads in but cant hear any sound.
Hi I have parent movie loadertest1.swf with 1 Symbol ( "myLoader" movieclip) on stage frame 1. actions for frame 1 are:
myLoader._lockroot = true;
myLoader.loadMovie("soundmov.swf");
my child movie (soundmov.swf) has a looping sound - actionscript on frame 1 is:
var snd = new Sound();
snd.attachSound("windup");
snd.start(0, 10);
I have also drawn a yellow square on the stage so i can see it is definately being loaded into the parent clip. When the movie soundmov.swf is played on its own you can hear the looping sound, when the soundmov.swf is pulled into the parent movie loadertest.swfinside the movie clip 'myLoader' ya can't hear no sound!...hoping someone has some ideas, ? its doin mi nut in !!!
[Q] Duplicating Movieclip With Loaded External Jpg File
Hi, Im trying to make thumbnail and enlarged picture by duplication.
What i tried was using duplication of thumbnail movieclip which jpg image is loaded
However it seems not working as i intended,so I had to make empty movieclip and loaded image again!!!
I am concerning that if I use new movieclip and loading the image again..it means users have to download the same image twice.
Basically, I am trying to make a list of thumbnailed images with enlarged picture popes up when mouse rolls over them
Is there any proper way to make it happen?
or duplication just doesnt work even thou movieclip is already loaded with image?
Thank you for your time~
External .swf Loaded Into Movieclip Doesn't Respond
Ok. I have a flash movie that contains a movieclip called "m_externalSection" and when a user presses a button it loads one of many external .swf's.
These .swf files are basically filled with some buttons that move around when you click them and some text fields that change depending on what button you've clicked.
The external .swf files work fine on their own, but when you load them into "m_externalSection", they don't do anything, none of the buttons does anything at all. Flash 'sees' the buttons (the cursor changes to a hand) but when you click nothing happens.
What could I be doing wrong so that my external .swf isn't working when it's loaded into a movieclip?
Thanks.
--Xezton
External .swf Loaded Into Movieclip Doesn't Respond
Ok. I have a flash movie that contains a movieclip called "m_externalSection" and when a user presses a button it loads one of many external .swf's.
These .swf files are basically filled with some buttons that move around when you click them and some text fields that change depending on what button you've clicked.
The external .swf files work fine on their own, but when you load them into "m_externalSection", they don't do anything, none of the buttons does anything at all. Flash 'sees' the buttons (the cursor changes to a hand) but when you click nothing happens.
What could I be doing wrong so that my external .swf isn't working when it's loaded into a movieclip?
Thanks.
--Xezton
Imagesize Of External Image Loaded Into Movieclip?
Hi,
I need to centralise an image that I load in an "image viewing panel" that I had to make. The loaded images have different width and height values (so I can't use a mask). I was looking to get the width of the movieclip before and after I loaded the image into it, but eventhough the image is huge, it doesn't change the width of the image. In order to position the loaded image, I should be able to get the width and height values through ActionScript in Flash, but I can't find a way to do that. Anybody have some advise?
Thank you...
External Loaded Variable That Defines Frame Of Movieclip
I have a Movieclip with 3 Frames (One, Two, Three) and i have a txt File where i have either One, Two or Three. The swf should load the txt file and set the movieclip to the frame that it loaded from the txt file, but its not working.
Why?
Trying To Get Externally Loaded SWF To Act As Movieclip From External Class (.as File
Right I have a problem - when I load a swf and I want to be able to add event listeners to propertys on it I use the code
ActionScript Code:
var headerMovie = MovieClip(loader.content);
Which works fine but what I've have created now is a class to load external SWF's and add them saving me to repeat that code, which works fine for loading the swf but as for the part where I get it to convert to MovieClip (which is what I assume that bit of code does) I'm out of Idea's.
here is the class so far - the error it gives is that it cannot acces the property mloader, I've even declared it outside of the function but to no avail.
ActionScript Code:
package {
public class PreLoaderSwf3 extends MovieClip {
var myTween:Tween;
public var loaderSpin:MovieClip = new Loading_MOV();
public function PreLoaderSwf3() {
//stuff for preloader spinner
loaderSpin.x = 500;
loaderSpin.y = 80;
loaderSpin.alpha = .5;
}
public function startLoad(swfAddress) {
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest(swfAddress);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
mLoader.x = -400;
addChild(mLoader);
//loadEvent.currentTarget.content = MovieClip(mloader.content);
//mLoader.alpha = .5;
//return convertName;
}
function onCompleteHandler(loadEvent:Event) {
loadEvent.currentTarget.content = MovieClip(mloader.content); //The code giving me trouble
addChild(loadEvent.currentTarget.content);
loadEvent.currentTarget.content.alpha = 0;
this["myTween"] = new Tween(loadEvent.currentTarget.content, "alpha", None.easeInOut, 0, 1, 8, false);
removeChild(loaderSpin);
}
//stuff for adding spinner loaders and shit all works grand
function onProgressHandler(mProgress:ProgressEvent) {
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
addChild(loaderSpin);
}
}
}
How To Change Color Of Nested Movieclip Dependent On Loaded External Swf
Greetings! I am making a Flash website. Each "page" is loaded using the mx.controls.Loader. My navigation menu is simple: when you hover over the link, the text instantly changes white, and a colored box appears behind the text. This is the code (only two buttons) :
Code:
//LOADER
var mcLoader:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
mcLoader.addListener(myListener);
mcLoader.loadClip("home.swf",myLoader);
// Include MC Tween
#include "mc_tween2.as"
//Assign BreadCrumb Functions and Load External Movies
home_bn.onRelease = function () {
mcLoader.loadClip("home.swf",myLoader);
}
events_bn.onRelease = function () {
mcLoader.loadClip("events.swf",myLoader);
}
}
QUESTION: How do I make all the colored boxes in the buttons change color depending upon what "page" is being viewed.
Please note that I have tried making the buttons as Movieclips, with the colored boxes as child movieclips, then using the colorto AS, but it does not work...
Does anyone have a suggestion?
Preventing External Swfs Loaded Into A Movieclip Image From Stacking
So I've been building a webpage that contains 5 "content" sections each loaded on their own swf files into a movieclip called loader_mc when I click the corresponding button. So far, my code works to load the swf's into a movieclip entitled loader_mc when I click on the respective buttons but when I try to change sections, that's where things unravel.
The "samples" section streams video, and when I leave the "samples" section, the audio is still streaming even if I'm looking at the "about" page (or any of the other for that matter). It seems as if my swf's just keep loading one on top of another (not what I want), where what I want to accomplish is to have the swf files replaced upon clicking a button with whatever swf is appropriate to the section I've just clicked. That way dynamic content doesn't sound or appear to be playing even when the user is supposed to have made it "go away". Below I've pasted the code that I think you'll all need to see in hopes you may be able to assist me in tweaking my code to get it to operate.
Here's where I defined my variables:
var contentLoader:Loader = new Loader();
var aboutURL:String = "z_about.swf";
var aboutRequest:URLRequest = new URLRequest(aboutURL);
var samplesURL:String = "z_samples.swf";
var samplesRequest:URLRequest = new URLRequest(samplesURL);
var contactURL:String = "z_contact.swf";
var contactRequest:URLRequest = new URLRequest(contactURL);
var linksURL:String = "z_links.swf";
var linksRequest:URLRequest = new URLRequest(linksURL);
var homeURL:String = "z_home.swf";
var homeRequest:URLRequest = new URLRequest(homeURL);
And here's an example of one of my buttons codes for the Click event:
function linksClick(event:MouseEvent):void
{
zMenu.links_words.gotoAndPlay("click");
contentLoader.load(linksRequest);
loader_mc.addChild(contentLoader);
}
Does anyone have any idea where I might have gone wrong? I've made it this far mostly through tutorials, but I think I'm in a little over my head at combining the things I've picked up without forgetting important elements. Any help is greatly appreciated.
XML Loaded In Container =no Work
Hi all,
I`m trying to load a XML mc into a container mc. It works fine when I simply load the xml mc into the a different level, butit won`t when I use a container file.... e.g.
_root.loader.loadMovie("menu.swf"); // loader is the container mc
any ideas?
thanks,
m.
Swf Loaded In Container Won't Work
Hi all,
I built a variation of Comic Geeks easing menu system (http://www.actionscript.org/resource...tem/Page1.html) which works fine just by itself.
After loading it into a Container of my main movie, the buttons refuse to function though.
Since I'm not a pro my best guess is that it might have to do with the actionscript?
Most likely the _root reference or the coordinates of the loaded movie don't work, but it doesn't react at all.
I'd apreciate any help on this.
Here's the code from the loaded movie:
//during the time the movie loads, we set the current
//position of the content at 0,0; thus showing the
//HOME section of the site.
onClipEvent (load) {
_x = 0;
_y = 0;
div = 5; //This value just determines the speed
//the transistions.
}
//Here we constantly check for new values of
// _x and _y. These values are determined by endX and endY.
//We divide the difference by div to have an value that
//continues to change until the equation is true.
//Try changing the 'enterFrame' with 'Load' to see the
//difference. You would then have to click on a button
//several times before the transistion completes.
onClipEvent (enterFrame) {
_x += (endX-_x)/div;
_y += (endY-_y)/div;
//We then use the onRelease method to determine the
//new values of endX and endY. This is a new feature
//in Flash MX.
_root.home.onRelease = function() {
endX = 0;
endY = 0;
};
_root.works.onRelease = function() {
endX = -700;
endY = 0;
};
_root.skills.onRelease = function() {
endX = -1400;
endY = 0;
};
Many thanks!
AS Not Working When Loaded Into Container..
This code fades in a sound when the movie starts, and fades out when it reaches a specific frame. On its own, it works perfectly. The issue is when I try to view the page with the main holder SWF, which loads the separate SWF sections in with a container. I can't see why it wouldn't work when loaded. There are 3 other sounds on the page that work perfectly even when viewed from the container.
My entire site is done except this sound issue, so any help would be greatly apprecaited.
Quote:
cityLoop = new Sound(cityLoopMc);
cityLoop.attachSound("city");
cityLoopVolume=0;
cityLoop.setVolume(cityLoopVolume);
fadeIn01=1
cityLoop.start(0,999);
onEnterFrame = function () {
//Fade In
if (fadeIn01==1) {
cityLoop.setVolume(cityLoopVolume);
cityLoopVolume=cityLoopVolume+1;
if (cityLoopVolume>99) {
fadeIn01=0;
}
}
// Fade Out
if (fadeOut01==1) {
cityLoop.setVolume(cityLoopVolume);
cityLoopVolume=cityLoopVolume-3;
if (cityLoopVolume<5) {
cityLoop.stop("city");
fadeOut01=0;
}
}
}
Calling Method From AS2.0 Loaded Swf In As3.0 Container Swf
Hi,
i m updating my e-learning course player project with Flash cs3 and AS3.0. the old version of course player is developed in As2.0. which load cousre swf files .
it is working fine Flash8 As2.0.
the new course player load course swf. the loaded course swf on a specifec frame call a method like this
_level0.setButton(2) method from course player;
The setButton(parameter) method defination is in new courser player. the loaded movie which is develped in Actionscritp2.0 not finding this method
in new course player which in Actionscript3.0. its working well with the old course player.
can any one give me solution to solve the issue.
i can’t make changes in course swf files b/c there are thousand of course swf files in developed in as2.0.
i have used Swfbridge component and also local connection classes
but both are two way communication, so i have make changes in thousand of swf files of my cousrer ???
can any one give solution of this issue or guide me the right thing to do
regards
Shane
Class Not Working When Loaded Via Container
Hi there
I have made a button component that uses a class file to interact with Flash. (buttonControl.as).
I have basically created a shell that handles the navigation of all the content. That means that I am creating all my content externally in SWFs, which get loaded into the container file.
Heres the problem:
When I export the file, and it runs in its own SWF, it works beautifully. When I load it into my container file, however, it stops working. It's like Flash isn't loading the class, or at least, only partially loading the class. The thing is, my buttons are active, but the onRelease actions don't work.
Copying the component into the container file's library and duplicating the .as file fixes the problem, but is there another way?
File structure like this:
Root > Content > myFile.swf
buttonControl.as is in Content folder...
Thanks!!
Stop Loaded SWF From Resizing To Fit Container
I am really new to this, having recently decided to take up ActionScript 3.0 after years of Visual C++... I am having major troubles, the most recent being that I can't get a dynamically loaded swf to be the size that I want. Get this... The swf is x by y. I know the dimensions. I am not trying to make it scale to other dimensions. I am trying to KEEP it from scaling automatically. My app is dimensions w by h, and I load a swf of known dimensions x by y. For some reason, the result is a loaded swf that scales yet keeps it's aspect ratio: in this case, it scales until it fills up the y, leaving whiteness on both sides (x). Ok, I am using a Loader. I set width and height properties, and the swf doesn't load at all. I stuff it (the loader) into a sprite or movieclip and set the width and height; no swf. It only shows up on the screen if I let it do what it wants, which is to take over the whole app client area. HOW do I force it to stay the size that it is supposed to be? Better yet, can anyone tell me what good having a width and height property is if you can't set them without breaking your application? How does one create a container of a given width and height. Everytime I try to do it, the result is that the container doesn't exist.
Oh yeah, I forgot to mention - I am doing this in straight ActionScript 3.0 - no Flash IDE. I use FlashDevelop.
Naming An MC Loaded In Container In Different Movie?
I have a movie that is created with document class (Tree.swf).
This movie is loaded into a container (container.swf):
ActionScript Code:
/* Load the tree */
var myLoader:Loader = new Loader();
var myTree:DisplayObject = addChild(myLoader);
var url:URLRequest = new URLRequest("Tree.swf");
myLoader.load(url);
myTree.name = "Tree";
myTree.x = 450;
myTree.y = 300;
How to I give the loaded movie a name? Right now it is just instance2? The name property seems to only apply the the loader child?
Movie Clip: Target="_level0.Tree"
Movie Clip: Target="_level0.Tree.instance2"
Naming An MC Loaded Into A Container Movie?
I have a movie that is created with document class (Tree.swf).
This movie is loaded into a container (container.swf):
ActionScript Code:
/* Load the tree */
var myLoader:Loader = new Loader();
var myTree:DisplayObject = addChild(myLoader);
var url:URLRequest = new URLRequest("Tree.swf");
myLoader.load(url);
myTree.name = "Tree";
myTree.x = 450;
myTree.y = 300;
How to I give the loaded movie a name? Right now it is just instance2? The name property seems to only apply the the loader child?
Movie Clip: Target="_level0.Tree"
Movie Clip: Target="_level0.Tree.instance2"
Using Same Class Name In Container And Loaded SWFs
I have an application that is structured as a master SWF X which loads in a variety of children SWFs using the Loader class. It displays each child SWF within a viewport in the master SWF: a simple design.
I typically create a top-level class named "Application" for every SWF I build. The contents of the Application class is completely different from SWF to SWF, it's just the same name for the top-level container within each particular SWF.
Now I am finding in AS3 (which I have only migrated to recently), that when I load up a child SWF in the master SWF, what appears in the viewport is NOT the child SWF, but instead another copy of the master SWF. It's as though it locates the class name when running the child SWF and reuses the Application reference to mean the a new copy of the master.
I was able to fix it by renaming the child's Application class to a variant ("Application_06"). But it will be trickier if there happens to be some little helper class in the child SWF which happens to share the same name as a class in the master SWF -- which is very likely to occur. Isn't there a way to run an SWF within another such that they don't pay attention to the internal class names of the other SWF?
XML Photo Gallery Loaded In A Container Mc
Hello, I used the XML photo gallery tutorial to create the gallery section of my site. When I publish the movie it works perfectly. My concern is this is only a section of my site so I'm loading this section into a container mc. When its loaded in the container its a little buggy. For instance, the text fields dont display. Is this a scoping issue? I didn't think it was but I definately could be wrong. Also, I figure this was just a movie running independently of my main container but some of the gallery buttons are controlling my main mc container!! Please let me know if this makes sense. Is there something else I need to know in order to have the text display properly?
Thanks for all your help in advance.
How To Use A Loaded Swf To Load/unload Another Container?
I'm having difficulty addressing loaded swfs and I'm going nuts trying to solve this. Please help!
How can I get a swf loaded into a container clip (in a main movie) to load/unload another container clip (also in the same movie)?
Here's the container clip in the main movie:
var story:MovieClip = this.createEmptyMovieClip("storyHolder", 3);
story._x = 675 ;
story._y = 325;
var storyLoader:MovieClipLoader = new MovieClipLoader();
storyLoader.loadClip("aboutStory.swf", "storyHolder");
and here's the button script (from a swf loaded into a container in the same main movie) I'd like to use to load/unload the above container:
this.crewBtn.onRelease = function() {
_root.storyLoader.loadClip("aboutCrew.swf", "storyHolder");
The above movieclip traces fine but it won't load the "aboutCrew.swf" into "storyHolder".
thanks for any insight!
Movieclip Container Question
Hi,
Was hoping someone could help me out with this?
I have a button on the main stage that when clicked loads a jpg into an empty movieclip container, also on the main stage. Is it possible to be able to click on the jpg when its loaded in the container and have it open a larger window?
I have two scenarios: (1) where you click on the jpg and it opens another window that links to a website, and (2) where clicking on the jpg opens the jpg in a larger window but with the ability to specify the size of the new window?
Hope that makes sense?
Changing Container Of A Movieclip
Hello,
From what I understood, attachMovie takes a symbol (e.g. a movieclip) from the library and attaches it to a movieclip. Given this, how can I attach a movieclip that was created dynamically at run-time (hence no symbol defined into the library) to another movieclip.
I try to dynamically change the container of a movieclip.
Thanks for your help,
Cyrille
Add A Bitmap To A MovieClip Container
Hello, I've run into another hitch while fooling around with my little chess game. Heres the problem, I want to load external images into an array called: arrayImages. Then I want to take those images and put them into customized movie clip containers so that the user would be interacting with the movieclips themselves and not the images directly.
The problem I've been running into is adding the bitmap as a child of the movieclip so that it will display. The image is being loaded correctly, running addChild(loader) displays the image as I would want it, except that its not contained in the movie clip (in this instance the movie clip is named pawn).
Any idea's or suggestions about what I might be doing wrong, or basic examples of how to take a bitmap object, and place it in a Movieclip container. so that it will be viewed as a child of the Movieclip.
Thank You!
Attach Code
var arrayImages:Array = new Array();
var arrayLoader:Array = new Array();
var loader:Loader;
var pawn:MovieClip;
const PAWN = 4;
pawn = new MovieClip();
pawn.x = 100;
pawn.y = 100;
pawn.height = 100;
pawn.width = 100;
addChild(pawn);
arrayLoader[PAWN] = "./images/pawn.png";
loader = new Loader;
loader.name = PAWN;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ImageLoadComplete);
loader.load(new URLRequest(arrayLoader[PAWN]));
internal function ImageLoadComplete(e:Event):void {
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, ImageLoadComplete);
arrayImages[loader.name] = Bitmap(loader.content);
//addChild(loader);
//addChild(arrayImages[loader.name]);
trace(pawn);
pawn.addChild(arrayImages[loader.name]);
trace(arrayImages[loader.name]);
}
Scaling JPG To MovieClip Container
I´m loading a JPG image into an empty movie clip as an Holder.
I want to scale the JPG to the Holder´s size.
Loading is not a problem, scaling neither, but ....
to get the loaded JPG _width and _heigth is burning my mind
below is the code section I´m using inside an class
Code:
var imgHolder = detail.createEmptyMovieClip ("imgHolder", detail.getNextHighestDepth ());
var my_mcl:MovieClipLoader = new MovieClipLoader ();
// Create listener object:
var mclListener:Object = new Object ();
mclListener.onLoadError = function (target_mc:MovieClip, errorCode:String, status:Number)
{
trace ("Error loading image: " + errorCode + " [" + status + "]");
};
mclListener.onLoadStart = function (target_mc:MovieClip):Void
{
trace ("onLoadStart: " + target_mc);
};
mclListener.onLoadProgress = function (target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void
{
var numPercentLoaded:Number = numBytesLoaded / numBytesTotal * 100;
trace ("onLoadProgress: " + target_mc + " is " + numPercentLoaded + "% loaded");
};
mclListener.onLoadComplete = function (target_mc:MovieClip, status:Number):Void
{
trace ("onLoadComplete: " + target_mc._width + " " + target_mc._height);
};
my_mcl.addListener (mclListener);
my_mcl.loadClip ("cristo.jpg", imgHolder);
I thougth I could get target_mc._width and target_mc._height after the Load is complete and then apply the proper xscale and yscale to imgHolder but I get ZERO for both.
What am I doing wrong ?
Thanks any help
João Carlos
Rio
Brazil
Resizing Container To Fit A Dynamically Loaded File
what's up? is there any way to have a container resize itself to the size of an externally loaded file such as a jpg?
right now i'm making a portfolio with many different pics, animations etc. to keep the file size down i'm storing all of my main files in an array and loading them via the loadMovie(); function. here is the problem:
there is a square on the screen in which is an empty movieclip that i'm using to load the file into. laying on top of this empty movieclip in a layer on top of it, i have a white outline that acts as a frame. i'd like the CONTAINER to scale itself to match that of the loaded file and also would like to have the FRAME layer to scale itself accordingly.
please help
thanks
itriix
Change _width Of Dynamically Loaded Jpg Container?
Hi guys
I'm working on a game and want the gfx to be loaded dynamically from a folder. I then want to edit some properties of the containing mc holder.
I have created an empty container, and successfully loaded the image as follows:
Code:
this.createEmptyMovieClip("borderHolder",0)
borderHolder.swapDepths(this.bottomDepth_mc)
borderHolder.loadMovie("./gfx/border1.jpg");
Now this works ok, but if I add
Code:
borderHolder._width = 100
... the mc & image aren't visible. The same goes with height.
Anyone have any thoughts on why this is?
Thanks for any & all suggestions!
Displaying Popup Windows From A SWF Loaded Into A Container
Hello everyone, I have an SWF which is being loaded into another SWF via a MovieClipLoader. The SWF which I am loading contains buttons which when pressed displays a pop-up window. When I test the SWF (with the buttons) by itself the pop-up windows display and everything is happy. When I click the buttons in the SWF when its loaded into the other SWF the pop-up windows dont appear. I'm assuming there is something wrong with the first parameter in createPopUp that is causing the windows not to be displayed. Here is the function that I created which is responsible for displaying the pop-ups. Can someone please tell me what I am doing wrong?
Code:
import mx.containers.Window;
function displayWin(cntTitle:String, cntLoc:String, sizeW:Number, sizeH:Number) {
var imgWin:MovieClip = mx.managers.PopUpManager.createPopUp(_parent, Window, true, {title:cntTitle,closeButton:true,contentPath:cntLoc});
var WinListener:Object = new Object();
WinListener.click = function() {
imgWin.deletePopUp();
};
imgWin.addEventListener("click", WinListener);
imgWin.setSize(sizeW, sizeH);
imgWin.move(180,90);
}
How Can Loaded Movie Send String To Container?
I have a simple movie (displaying a button) loading into an "interface". When the user clicks the button I want to assign a text string to a textfield on the interface main stage:
Code:
directions_mc.directions_tb.htmlText = str;
The attached files will show how things are set up. I'm not sure how to target the moviclip/textfield from the embedded movie in AS 3 since it no longer works to reference "_level0".
Stop And Start Movies Loaded Into Container.swf
Hey all -
I've got a fairly long movie with one "core.swf" with a frame and stop and start buttons. I have 5 external swfs that load into an empty mc with instance name "box_mc" in "core.swf".
These external swfs have a whole bunch o mcs within (obviously)
But I'm being rather dense here because I can't get the stop and start buttons to stop the whole movie (everything that needs to stop is in the external swfs)
Ive targeted it as such
ActionScript Code:
on (release) {
_root.box_mc.stop();
}
this is not working - any one have some ideas?
Thanks in advance!
Andy
|