ActionScript 3.0 :: How To Target Sub-MC Of Loaded .swf
Jul 10, 2007
Short version: I'm trying to load an external .swf from a URL and add event handlers to the movie clips (or it's movie clips sub-MCs) on its stage. I can't find a THING online on how to do this.Details:I've been tasked by my employer to build a simple control interface in flash, with just a few buttons to do things like display some info or images or maybe an associated MP3. I've written little test apps to do all of these individual things & managed to fake my way through.But the sticking point is that I'm now trying to place all the UI controls into an external .swf, which I then load into the canvas by a URL. The goal is to be able to load it into a variable named, say, 'private _ui:MovieClip' and then add event handlers to mivie clips within that bynamelike:_ui.someButton1.addEventListener(MouseEvent.MOUSE_ UP,handlerFunction1);_ui.controlStrip.someButton2.addEventListener(Mous eEvent.MOUSE_UP,handlerFunction2);The goal is that if we want to swap out the UI for a particular client, we just export a new .swf with all the correctly named MC instances & use the new URL to load the UI.I seem to be able to load the .swf OK and trace the movie clips "Main Timeline" like so:
_ui2.contentLoaderInfo.addEventListener(Event.COMP LETE , uiDidLoad);
function uiDidLoad(evt:Event){
trace("UI2 LOADED");
[code].....
View 14 Replies
Similar Posts:
Feb 5, 2010
I have a swf called anim1.swf acting as a preloder and loading anim2.swf. anim1.swf is attached to a document class called Racine.as. Once anim2.swf is loaded, how can I target the root of anim2.swf?
For example, anim2.swf contains 2 clips called clip1 and clip2. clip1 contains a child called clip1_1. How can I access clip2 from within clip1_1 by using an absolute way (I don't want to use the parent property)?
N.B : a way would be to have a document class attached to anim2.swf, but here there is none.
View 5 Replies
Jan 26, 2007
I'm loading a swf into a container clip and I'd like to target this swf for control such as gotoAndPlay, etc.
I thought targeting the container clip would do it but it's not. Here's my script so far:
var mediaMenu:MovieClip = this.createEmptyMovieClip("mediaMenuHolder", 1);
mediaMenu._x = 15;
mediaMenu._y = 175;
var mediaMenuLoader:MovieClipLoader = new MovieClipLoader();
mediaMenuLoader.loadClip("mediaMenu.swf", "mediaMenuHolder");
this.mediaMenuHolder.gotoAndPlay(2);
The swf is loading but I can't seem to give it any instructions.
View 2 Replies
May 30, 2009
Can someone help me out and tell me how i can set the size of an external swf i have loaded into a target movieclip.ive got the external swf loading into the target ok but its too big.
View 3 Replies
Jun 15, 2009
i have creating an image gallery of sorts. I have loaded my thumbnails through an xml like so:
Code:
function loadThumbs(){
for (var i = 0; i < totalElements; i++){
var thumb_url = elements[i].@thumbSrc;
trace("totalElements: " + totalElements);
[code]....
now i want to have it so that when u click a thumb, it re-layers them. I am able to get the one u click to the front of the order, but how can i tell the others to layer as i want? I guess the problem is that I cannot use the name of the display object and i can't user image_loader to setChildIndex with.
Code:
function replaceElementAndMoveThumb(event:MouseEvent):void{
setChildIndex(event.currentTarget, numChildren - 1);
trace(event.currentTarget);
}
I am thinking that in AS2 I would use the movieclip instance name, but don't think this works in AS3.
View 2 Replies
Oct 1, 2010
I'm trying to somehow target a MC being loaded into an empty container MC. I've tried everything I could think of.
Basically, I'm making a movie editor. Right now clips are added to the stage on initial load, then when they are clicked on they are added to the "reel" and they can be previewed in the order that they are added. Now, I'm trying to get it so that when they are on the "reel" they can be click and dragged and rearranged.
Here's how the clips are added to the stage in a function called loadClips():
ActionScript Code:
addChild(clip1);
clip1.name = "1";
Here's how they are being added to the "reel" in addClips():
ActionScript Code:
if (currentTarget.name == "1")
{
clipCopy = new Clip1();
[Code]....
Now, I just want the clips that are on the reel to be click and drag-able (along the X axis but I'll worry about that later). I realize now they're all being added as clipCopy. That's going to be an issue huh? Is there a way that I can target the container and make that mobile?
View 2 Replies
Aug 8, 2002
is it possiable to target/query a specific frame in a movie that i am loading into an empty MC...?
eg:
on (release){
if (loadedMoviePath._currentframe == 10);
loadedMoviePath.MC1.play();
}
loadedMoviePath - what would the path to the MC in the movie that has been loaded be?
whatGoesHere.MC1
View 2 Replies
Nov 5, 2006
I'm trying to target a .swf that I loaded into a movie clip (mc_container) but it seems like I'm missing something. Can you take a look and see where I went wrong?
Code:
mc_container.loadMovie("mc_photoSwap.swf");
//homepage Animation Swap Images
function photoSwapAni(){
switch(random(3)){
[Code]...
Also I see I'm going to have an issue with the random part because it could call the same animation twice or more times in a row. Should I ad some sort of if statement or is there a better way to do this random part of the code?
View 10 Replies
Jun 27, 2009
how i can set the size of an external swf i have loaded into a target movieclip ive got the external swf loading into the target ok but its too big.
View 2 Replies
Jul 30, 2010
A part of the Flash app. I'm working on right now does the following -Main stage loads an external swf using the following function:
function loadAsset(evt:String):void{
var assetName:String = evt;
if (assetName != null){
[code].....
View 25 Replies
Oct 18, 2011
I'm using buttons to send the playhead to frames in which swfs are then loaded into an otherwise blank movieclip called "stage_target_mc" ...how can I then flush out the previously loaded swf so only a newly loaded swf displays in "stage_target_mc"?For example, after clicking upon the 'about' button the 'about' swf loads...then if the 'concepts' button is clicked the 'concepts' swf loads -- but the previously loaded 'about' swf still plays...I would like to be able to flush the 'about' swf so only 'concepts' is display, in this example.code associated with buttons used to send playhead to frames "concepts" or "about":[code]
View 1 Replies
Apr 28, 2010
I have gallery which I want to modify. Now, I load big image on the stage by clicking thumbnail menu. I can see a small preview of that thumbnail on mouse over. Thumbnail preview is done by cloning thumbnail image and nest that image into thumbnail preview window.
[Code]...
However, it did not work yet. I do something wrong. I am wondering if someone can help me to figure it out. I spent a lot of time to modify it as It looked like a simple thing but without any success. I will provide more information if needed. The project consists of many classes I can explain more if the information I provided is not enough.
View 0 Replies
Mar 15, 2011
I'm having trouble adding a cuepoint listener to a dynamically loaded .flv which targets a dynamically loaded .swf. I'm also adding cuepoints via actionscript.
Basically everything loads okay but I get a compile error in the the function cuePointHandler when referencing mc_slideLoader.
Scene 1, Layer 'Actions', Frame 1, Line 601061: Call to a possibly undefined method gotoAndPlay through a reference with static type flash.display:Loader.
I'm still a rookie with AS3 so I'm thinking the Loader class doesn't have a gotoAndPlay property and some how I have to get it to act like a MovieClip?
Here's the actionscript.
ActionScript Code:
// using Flash version CS5
import fl.video.*;
import fl.video.FLVPlayback;
[Code]....
View 7 Replies
Mar 1, 2004
How come i handle the movieclip which i loaded into target movielip?
View 1 Replies
Jan 3, 2007
I have a script that loads images and text from an XML file into movieclips.The following code is what creates the movieclips that contain the elements:
Code:
var thumb_mc:MovieClip = _root.mc_conteudo.createEmptyMovieClip("thumb"+(1+i), _root.mc_conteudo.getNextHighestDepth());
var img_mc:MovieClip = thumb_mc.createEmptyMovieClip("img", 0);
I can't seem to find a way to target the thumb_mc or the img_mc so they have rollover effects and actions (they are created for each set in the xml file, so there are multiple mc's)mc_conteudo is the content mc that scrolls.The swf is here: http:[url].....
View 13 Replies
Jun 2, 2003
I am trying to load an external swf into a target. When the swf is completely loaded, I want to execute the next set of actions. I am trying to develop my flash websites so that no coding is done within the child swfs. So I would assume some code like this would work:
_root.holder.loadMovie ("child.swf");
if(_root.holder.getBytesLoaded ==_root.holder.getBytesTotal){
_execute some other command;
}
However it doesn't work! So is there a way to detect when a specific child swf has fully loaded into a target (not _framesLoaded please!) and then set a variable to allow some other actionscript to kick in?
View 13 Replies
Apr 14, 2004
Is it possible to target a loaded movie within the main timeline and stop sounds in that particular movie only?
View 4 Replies
Dec 18, 2006
is there a way to target loaded movies other than through loadMovieNum() or creating localConnection?
View 1 Replies
Feb 14, 2004
When I load a .swf into a target movie that I have on my main page, it is all wrong, the slider menu that I have loading into the target movie, does not stay inside target and it seems to reposition the slider menu to the x psotion of my main movie How can I fix this, so the slider menu in the swf stays inside the target movie when loaded?
FLA file is too large to attach, if needed I can attach it in pieces.
View 3 Replies
Apr 14, 2004
Is it possible to target a loaded movie within the main timeline and stop sounds in that particular movie only?
View 4 Replies
Nov 11, 2008
is there any reason for this AS not to work. I have checked and double checked and cant find a reason.
[Code]...
I have used _root also just to check and what happens with both is that the swf is loaded but not into the target "theClip1", It takes over the whole screen.
View 1 Replies
Jul 13, 2003
i have main.swf with FPushButtonSymbol-linkageID in libary on main timeline a have this:
this.createEmptyMovieClip("holder",10);
this["holder"]._x=100;
this["holder"]._y=100;[code].....
THE PROBLEM: the button is not attached.i know that this don't work by default, and i could use loadMovieNum but i realy do need this TARGETS-mc.I would say: load into a _level, not into a target. That's the usual "getaround" with attached symbols that preload before anything else. If they really need to be in targets, once they are loaded into _level1 for instance, and cached, load them again into your holders.
View 2 Replies
Sep 29, 2003
On the attached exercise, is it possible to stop further items being dragged onto a target when the target box is full?
View 1 Replies
Nov 28, 2011
What is the difference between target and currenttarget in flex?What is the difference between Target and Current Target in Flex especially in mouse events.
View 2 Replies
Aug 30, 2010
qi have a movieclip which is added to the stage:
var profileholder:profileHolder=new profileHolder ;
inside of profileholder is another movieclip(infoBtn) that acts as a button.when the mouse is over profileholder i want to do something with infoBtn like:
//profOver is the over state of profileholder
function profOver(e:Event) {
e.target.infoBtn.alpha=1;
}
this doesn't work and brings up this error:ReferenceError: Error #1069: Property infoBtn not found on flash.display.Loader and there is no default value.
at main_fla::MainTimeline/profOver()
i also tried:
function profOver(e:Event) {
var item:profileHolder=e.target as profileHolder;
item.infoBtn.alpha=1;
}
and get this error:TypeError: Error #1009: Cannot access a property or method of a null object reference.
View 1 Replies
Mar 14, 2005
i don't know why this isn't working.i got a button. and when it's pressed, i need it to go and play a frame in a movie clip. i'll test it and then when i click on it, i get this:
Target not found: Target="whoweare" Base="_level0.instance20.instance48.instance49"
this is the code that i am using:
on (press) {
tellTarget ("whoweare") {
gotoAndPlay (51);
}
}
View 14 Replies
Feb 16, 2005
so, i'm making an animated rollover, and i get an output error that says this:
Target not found: Target="_root.icon01" Base="_level0"
i have no idea what the base="_level0" means.
View 1 Replies
Sep 23, 2010
I have a shell swf that is loading a swf. How do you have the loaded swf tell the parent loader to unload itself after the loaded swf finishes playing?
View 4 Replies
Jun 14, 2011
Im working on a project that has a main swf file associated with the document class. It loads XML that provides the text content for the project, then it loads a swf that contains a font in its library, then it loads the first of several content module swfs. When the font swf has inited, I'm registering its library font with Font.registerFont(), and using it in a TextFormat object. After everything is done, I can add code to the document class to create a text field on the stage of the main swf and format it successfully with the TextFormat object, but when I try to do the same thing inside the loaded content module swf, the text doesn't show up there at all.
View 1 Replies
Jun 15, 2011
I'm working on a project that has a main swf file associated with the document class. It loads XML that provides the text content for the project, then it loads a swf that contains a font in its library, then it loads the first of several content module swfs. When the font swf has inited, I'm registering its library font with Font.registerFont(), and using it in a TextFormat object. After everything is done, I can add code to the document class to create a text field on the stage of the main swf and format it successfully with the TextFormat object, but when I try to do the same thing inside the loaded content module swf, the text doesn't show up there at all.
View 7 Replies