ActionScript 3.0 :: Targeting A Button Inside Dynamically Loaded SWF
Jun 4, 2010I have a main.swf which loads a sub.swf. Inside the sub.swf is a button instance (myBtn). How do I access myBtn from main.swf timeline?
View 7 RepliesI have a main.swf which loads a sub.swf. Inside the sub.swf is a button instance (myBtn). How do I access myBtn from main.swf timeline?
View 7 RepliesI'm trying to target a movieclip inside another movie clip which I have dynamically generated the name.
ActionScript Code:
firstText = "text" + randomNum;
_root[firstText].gotoAndStop(9);
[Code]....
The first part works, I can "firstText" and I can make it go to frame 9 and stop but I can't manipulate the movie clip "title_txt" which is inside "firstText"
Having trouble targeting movieclips in a dynamically loaded swf. (Flash 8, Actionscript 2).I have a swf file, which contains a set of duplicated movieclips, that I am loading into another swf file (using the movieClipLoader() class), basically like this: "swfA" is loading into "swfB", and I have clips 1, 2, and 3, inside "swfA."I don't seem to be able to mouseover and click clips 1, 2, and 3, when "swfA" is loaded into "swfB". But when I run "swfA" on it's own, the clips are active and clickable.I've tried setting "this._lockroot = true;" at the top of "swfA", and tha in the duplicating script, but still no luck targeting the clips.I usually execute the duplicating script on the main swf (swfB), but I wanted to contain everything in a swf, thinking it might be simpler. But the targeting problem has me scratching my head.
View 1 RepliesI loaded this "slider" swf into a "sliderHolder" on my index swf file. inside that loaded swf there's a movice clip called icon_mc. I'm trying to target it and make it go to a specific y position within that loaded swf on a MouseEvent inside the index.swf. I can't seem to make it work.I triedI have traced sliderHolder and it says it's empty.I have traced sliderLoader and it gives a Loader.So how do I access the movieClip if I just have those two as references?Here's what I have and want to do in code:
Code: Select all
var sliderLoader:Loader = new Loader();
sliderLoader.load( new URLRequest("sliding/ImageBar.swf"));
[code].....
So from the headline u know that i want to do but i don't know how to do it!
ActionScript Code:
/// activate the mc with the button from the main Menu
mathSecondMenu.addEventListener(MouseEvent.CLICK, otvoriVtoroMenu);
[Code]....
the problem is that i can get to the button from the first event, but i can make the Mc "proba" to go to "math_basic"!
How do you target a certain frame number/name from outside of that specific movieclip?
Code:
whoweare.addEventListener(MouseEvent.CLICK, whoweareClick);
function whoweareClick(event:MouseEvent):void{
gotoAndPlay("whoweare");
}
I'm assuming it's something with the gotoAndPlay function... but I've tried numerous things with that and nothing is working.
Trying to target a button inside a mc in order to trigger a swf.the mc is called "nav_btns"the button is called "contact_btn" The swf has the same name as the listener in order to repeat the function with multiple swfs. my problem is, i'm getting an error of an Access of undefined property with my mcI geting an error:"1120: Access of undefined property nav_btns.
my code:
var Xpos:Number = 461;
var Ypos:Number = 294;
[code].....
I am trying to set value of a textbox inside a swf loaded dinamically in the main swf...i am using
Code:
this.getChildByName("nuvoletta").textbox_value.text = "something";
but i get error 1199
I am forced using getchildbyname
I'm having trouble getting my scrollbar to work with dynamically loaded movies inside the movie the scrollbar is attached to.An example of my working scrollbar code with static data and my broken scrollbar with dynamic data can be found here: [URL]
I have a for loop that pulls data from my database, populates a topMovie(contentMain) with 20 subMovies inside it. My scrollbar is attached to topMovie. Once the data is loaded and the topMovie is populated, the scrollFace(not ScrollTrack) dissapears and the dynamic movie is not scrollable.As a test, I populated the topMovie with graphic boxes and no dynamic movies and it scrolls just fine.
Scrollbar code:
Code:
scrolling = function () {
var scrollHeight:Number = scrollTrack._height;
var contentHeight:Number = contentMain._height;
var scrollFaceHeight:Number = scrollFace._height;
[code]....
I am trying to access a button inside an external swf file that I loaded. Problem is every time I try to access this button I get an error saying that it's null!
Here is my code:
public class DocumentClass extends Sprite
{
public var loader:Loader;
public var swfFile:URLRequest;
[Code].....
Now this should work, code-wise I think its correct. The problem is that loader cant find the required button. There is indeed a button in the loaded movieClip with an instance name of "button", I double checked that.
[URL] basically i was just a layer too high and this is why i couldn't access anything..
I have 10 MC that are generated inside of a for loop. Each MC got another MC inside of it that is already sitting on the stage and has it's own instance ame applied! After that I put them inside of a MC container, that I also add dinamicly through the addChild method! But I have one issue when I want to change the position of the child MC(one that is sitting on the stage), through targetting to it's instanceName! The code I use:
Code:
var box1_mc:Box1 = new Box1();
var ball1_mc:Ball1;
var balls:Array = new Array();
[Code].....
My header is an mc with buttons that load swf's into a main content mc with this:on (release) { loadMovie("myswf.swf", _root.holder); and that works perfectly (content loads into mc with no page refresh).But..one of my loaded swf's has the same button code on a button to load swf's into the same mc and I get a page refresh.
View 1 RepliesI have a movie clip called curtain_mc with this actionscript inside:
[Code]...
I would like to change the variable 'f' from true and false by clicking a button but the actionscript on my keyframe doesn't recognize the actionscript in my movieclip? I know its a targeting issue, but not sure how to alter it in order for the two to talk to each other??
I have a function and some textfields within a movieclip, and I need to reference those textfields dynamically. This worked when I'd had the TFs on the stage, but not since I've placed them in an MC.The TF naming convention works out to this:
Code:
t_t1c1r1
t_t1c2r1
t_t1c1r2
[code]....
So, to access them dynamically, I combine the letters with index numbers to be gotten through the function's arguments.
Code:
this['t_t1c'+i+'r'+ii].text;
Object(this)['t_t1c'+i+'r'+ii].text;
The numbers represented by "i" and "ii" are coming through fine in trace, but the path is still wrong. I've tried different combinations of _level0, etc., but it only works in my testing when I make an absolute reference to the field (e.g. Object(_level0.mc_instance)['t_t1c'+i+'r'+ii].text which is not a viable solution).
I have a function and some textfields within a movieclip, and I need to reference those textfields dynamically. This worked when I'd had the TFs on the stage, but not since I've placed them in an MC.The TF naming convention works out to this:[code]The numbers represented by "i" and "ii" are coming through fine in trace, but the path is still wrong. I've tried different combinations of _level0, etc., but it only works in my testing when I make an absolute reference to the field (e.g. Object(_level0.mc_instance)['t_t1c'+i+'r'+ii].text which is not a viable solution).
View 1 RepliesI'm using the preloader like the one rhamej posted here:[URL]The part of the code I need help with is as follows:
[AS]
//fire the MovieClipLoader and attach the listener to it
var container1:MovieClipLoader = new MovieClipLoader();
container1.addListener(mclListener);
[code]....
I realize the code is wrong. I wondered if it was possible after loading an external .swf ("1_movie.swf") within the container, if you could then press a button (enter_button) located within the external .swf ("1_movie.swf") , and use the preloader code to load another external .swf on release ("tree20.swf"). I'm having trouble because the preloader code is in the main timeline of my main flash file ("index.fla"), and I don't know how to make the preloader code recognize the button located within the external .swf, and use it to load another external .swf within the same movie clip.
I'm using the preloader like the one rhamej posted here:
[URL]
The part of the code I need help with is as follows:
[AS]
//fire the MovieClipLoader and attach the listener to it
var container1:MovieClipLoader = new MovieClipLoader();
container1.addListener(mclListener);
[Code].....
I realize the code is wrong. I wondered if it was possible after loading an external .swf ("1_movie.swf") within the container, if you could then press a button (enter_button) located within the external .swf ("1_movie.swf") , and use the preloader code to load another external .swf on release ("tree20.swf"). I'm having trouble because the preloader code is in the main timeline of my main flash file ("index.fla"), and I don't know how to make the preloader code recognize the button located within the external .swf, and use it to load another external .swf within the same movie clip.
I have three movieclips (used as buttons) on my main MC. The following code swaps the depth of a dynamically loaded image the when I rollOver each movieclip (button). I want to put the button.rollOver code in a for loop so I dont have to repeat this code for every image loaded.
[Code]...
What I'm trying to do:I have an external JPG. I want to treat it as a button. on mouse over, I want it to fade in. However, I'm having problems understanding how to target this in my SWF.So 2 questions, can you target an external JPG to a Movie Clip inside my button? how do I target that?
View 1 RepliesI'm trying to detect the event.target of another function in the same calsses.
ActionScript Code:
public function menus():void {
menuArray[i].button.addEventListener(MouseEvent.ROLL_OVER,btnOver);
} private function btnOver(event:MouseEvent):void {
bgGlow();
} private function bgGlow():void {
square.x=[B]event.target.parent.x[/B];
}
Here is a simplified of the coding that I'm trying to target.
I am trying to target items inside a movieClip container. The container is called holder.
Inside holder I have a bunch of items such as other movieClips and TextFields.
How do I target, for example the TextField inside the holder clip??
Fore Example, I tried this, but doest work...
holder.textField.x = 100;
I want to target ALL the 20 clips attached as below, at the same time, when I press the button "blue". However, my code can target only ONE of the clips at any time. I have tried attaching the clips to a separate dynamic clip and then targeting it but problems with the registration point (0,0) of that clip means I cannot achieve the result I want:
Code:
for(i=0;i<20;i++){
mc = this.attachMovie("red","red2"+i,i);
var scaleFactor:Number = Math.random() * 80 + 20;
mc._x = Math.random()*500;
mc._y = Math.random()*400;
mc._xscale = scaleFactor;
mc._yscale = scaleFactor;
blue.onRelease = function(){
new Tween(mc,"_xscale",Strong.easeOut,mc._xscale,200,3,true);
new Tween(mc,"_yscale",Strong.easeOut,mc._yscale,200,3,true);
}}
I have an object that has properties that are numbered numerically but I cant seem to access them dynamically.[code]
View 3 RepliesI'm trying to make a flash widget that loads thumbnails from an xml document and have each thumbnail link to a different web page. So far everything works fine but I don't like using _root incase the widget gets loaded into another swf. In my expereice _lockroot dosen't always work.the line highlieted in red will only work if targeted through root as opposed to all my othere reference to ["placeHolder"+i] which use this.["placeHolder"+i]. I've tried _parent, this._parent and adding lots of other _parents. Nothing will work this is the file structure _root.placeHolder'N'.tn_mc. how I can substitute _root for a relative path.
widget_xml = new XML();
widget_xml.ignoreWhite = true;
widget_xml.load('flashWidget.xml');//path to document
[code].....
1. I'm loading an external swf onto my main swf.
2. Then I'm tweening an object which is separate to the loaded swf.
3. When the tween has completed I'm calling a function to make the loaded swf gotoAndPlay(2);
[Code]....
this code is working to load and position the external swf, but it won't gotoAndPlay to the frame inside the external swf--what am doing wrong here?
PHP Code:
bio.onPress=function()[code]......
The result I traced keep on coming back as the last in the list.It seems like the xmlList is not assign to different MC.
ActionScript Code:
private function levelsBG():void {
for (var i:Number=0; i<myXML.children().length(); i++) {
[code]......
Okay I'm working on a pretty big project, and the last thing I need to do is get this content to display. Here's my lil problem. So I'm loading buildings, and when clicked on, I'm loading a movieclip from the library that has a slideshow movieclip on the first frame, however this slideshow is packaged externally. This slideshow has a "xmlPath" that is defaulted to a XML file. My question is... what kind of code can I use to control which xml is loaded when loading that packaged slideshow?
[Code]....
People using the form mailer decide to load it externally and when they do they discover that the form won't go to the "thank you" frame. The onClipEvent (data) I assume fires but then you have [code]on the main timeline of the external swf and that didn't work. What is the secret to firing an onClipEvent inside an externally loaded swf?
View 7 RepliesI have been searching for an answer to this and can't seem to find one for AS3:I have a scroll pane component that dynamically loads a movie clip from my library. This movie clip has buttons inside that I would like to access from my main timeline. I can't figure out what my target path should be (for AS3).In AS2 it appears that it would be something like this:scrollpaneName.spContentHolder.inside_btn...AS3 doesn't recognize spContentHolder though so it must be something different...
View 4 Replies