URL For Buttons Created In A Loop
I need to set a unique getURL for buttons that are being created within a loop. With the code below, the links are created, but all buttons get the same URL (equal to the variable of last time the loop runs). How could I write this to where each button created has it's own unique URL based on the data called from the php file that time through the loop? Thanks in advance.
Code:
_root["movie"+i].attachMovie("Button", Button"+item,_root["movie"+i].getNextHighestDepth()); URLvar = this["thumbnail"+itemNumb]; _root["movie"+i]["Button"+item]._x = thumbLocation_x; _root["movie"+i]["Button"+item]._y = thumbLocation_y; _root["movie"+i]["Button"+item].onRelease = function() { getURL(baseURL+URLvar); }
Happy New Years!
DevShed > Flash Help
Posted on: January 2nd, 2008, 12:16 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
For Loop-created Buttons?
This doesn't seem to be working for me today ...
Code:
for (a=1 ; a<=63 ; a++){
_root["b"+a].onPress = function(){
trace(_root["b"+a]);//<-----------Undefined
gotoAndStop(a);//<-----------takes me to 64 regardless of button pressed
}
}
Any help appreciated as always
-Layne
On Press - Accessing Buttons Created With A Loop
I have generated a series of buttons using this:
Code:
duplicateMovieClip(sign, "sign"+z, z)
while still inside the loop that is creating the buttons I can get to each sign:
Code:
_root["sign"+z]._xscale = 240;
etc.
So, once the signs are on the stage - how do I determine which sign is clicked?
Code:
on (press){
trace(this._root.sign)
}
results in this ..._level0.sign... instead of say, ..._level0.sign0...
obviously because there is no loop.
Trying to access _name does the same.
Thanks
Charles
[F8] For Loop-created Nested Movies Not Working As Buttons.
Desperate!
I'm trying to dynamically create a portfolio presentation based on the contents of an xml file.
This code load sthe XML and fills arrays just fine. It creates a movie called "container+i" nested in the main "thumbnailBar_mc". This all works fine.
The problem is that I can't get those placed png files to act like buttons. When I manually create a clip and nest one the images in it, it works fine. But dynamically, nothing. Please help!
Code:
charts.onLoad = function(success) {
if (success) {
chartingDiagramArray = charts.firstChild.childNodes;
for (i=0; i<chartingDiagramArray.length; i++) {
thumbnailBar_mc.createEmptyMovieClip("container"+i, i);
thumbnailBar_mc["container"+i]._y = 150*i;
loadMovie("thumbs/ch"+i+".png", thumbnailBar_mc["container"+i]);
thumbnailBar_mc["container"+i].onPress = function(){
trace("Button hit");// <----- THIS ISN"T WORKING
}
}
trace("Loaded");
} else {
trace("Not Loaded");
//error message here
}
}
Targetting Mc's Created In A For Loop
Hi, I'm trying to use XML to populate a scroller with thumbnails. I have made a class for my buttons to give them rollover effects. I got Flash to add a button for each node in the XML ok. I can get the thumbnails to display ok on the stage, but when I try to stick them in to the buttons where they should live, it breaks.
Here's the code, which doesn't work:
Code:
for(var i:uint=0; i<il.length(); i++)
{
var t:Thumb = new Thumb();/*"Thumb" is the class name for the button*/
if (i!=0)
{
thumbY += buttonSpace+buttonHeightY;
}
t.y = thumbY;
thumbBox.content.addChild(t);
t.name = "thumb" + i;
thumbLoader = new Loader();
thumbLoader.load(new URLRequest(il.thumbName[i]));
thumbBox.content.thumb[i].ima.addChild(thumbLoader);/*this is the bad line*/
}
Here's the error:
TypeError: Error #1010: A term is undefined and has no properties.
at videoLocker_fla::MainTimeline/onLoaded()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
The problem is targeting the new thumb and putting the image in there. If I just put thumbBox.content.addChild(thumbLoader) the images show up as expected. I've also tried "thumbBox.content.t.ima.addChild(thumbLoader); "
Any help would be great. Many thanks -
Variables Created With A Loop. How
Hi everybody,
I am trying to create several color Objects to affect several movieclips with setTransform using the same object. I think that is the way to go if I want to affect several movieclips with the same color variation.
I would like to use a loop for();
BUt I have no idea how to do this
...
Could you please tell me what you think?
Thanks 4 Ur help
Help With Function Created In For Loop
I have the following code that should set the onPress events for movieclips
Code:
function actionSetter() {
for(var k = 0; k< 5; k++) {
trace(k); //traces correctly
_level0["EventBtn" + k].onPress = function() {
trace(k); //always traces as 5 regardless of which btn is pressed
}
}
}
What should I do to correctly define onPress for my movieclips within the loop?
Help please
AS3 - Shapes Created With A For Loop
guys, I'm stuck with this:
I'm using a for loop to display a few squares, those are being created as they should, but when I try to kill (remove) them all only the last one is being removed, I assume it has to be a problem with the for loop, below the code I'm using.
Code:
for (var i:int = 0; i<=totalItems; i++) {
var sp:Sprite = new Sprite();
addChildAt(sprite,2);
square = new Shape();
square.graphics.beginFill(0x000000,0.5);
square.graphics.lineStyle(0.5, 0xcccccc);
square.graphics.drawRect(5+20*i,10, 16, 16);
square.graphics.endFill();
sp.addChild(square);
}
Do you guys have any idea how to remove all the "squares" create within the for loop?
Thanks for alll your help.
funkysoul
ActionScript Created Textboxes In A For Loop... HELP
I have no idea why this function, when called, will not create multiple instances of a texbox with the instance name "myText2" and the variable "i" appended to the end. Any help would be greatly appreciated.
var theY,i;
theY=150;
loadVariables("testSwitchworx.asp", this);
function makeTextBox(var_i)
{
this.createTextField("myText2"+var_i,0,50,50,100,1 00);
this["myText2"+var_i].variable="product";
this["myText2"+var_i].border = true;
theY=theY*var_i;
this["myText2"+var_i]._y = theY;
}
for (i=0; i<=4; i++) {
makeTextBox(i);
i=i+1;
}
For Loop-created Targeting Problems
Here's the code:
desktop0_x = 22;
desktop0_y = 10;
desktop1_x = 22;
desktop1_y = 45;
for (var n=0; n<xmlDoc_xml.firstChild.childNodes.length; n++) {
pref_pane.attachMovie("prefs_thumb_holder", "thumb" + n, n );
target = pref_pane.getInstanceAtDepth(n);
target_x = ["desktop" + n + "_x"];
target_y = ["desktop" + n + "_y"];
target._x = desktop1_x; //THIS LINE "WORKS"
target._y = target_y; //THIS IS WHAT I WANT
trace(target_x);
}
The first bold line i a way to force the code to work, but it destroys the beauty of a for loop. How do I write the code that says the following:
movieClip[n]._x = desktop[n]_x;
I'm totally stuck at this point! Help!
[F8] Error Message Created By While Loop
Hi,
When I export my movie from Flash I get an error message that pops up and the movie seems to freeze. The error message says: A script in this movie is causing Flash Player to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?
This only happens when I try adding a while loop into my script but without one, duplicateMovieClip action keeps on duplicating each time the movie loops. What am I doing wrong?! The code is below. Please help!
PHP Code:
while (i <= 8){
function createMenus(titles)
{
for(var i = 0; i < titles.length; i++)
{
//copy mold
var newMenuItem = menuItem.duplicateMovieClip("menuItem" + i, _root.getNextHighestDepth());
newMenuItem.title = titles[i];
newMenuItem._y = menuItem._y + (menuItem._height * i);
newMenuItem.mySub = i;
newMenuItem.onRollOver = function()
{
scale(this, 240); //scale to 200%
};
newMenuItem.onRollOut = function() {
if (this != _root.selectedMC) {
scale(this, 100);
//scale back to original size
}
};
newMenuItem.onRelease = function() {
scale(_root.selectedMC, 100);
_root.selectedMC = this;
scale(this, 240);
//scale to 200%
_root.gotoAndStop(this.title);
};
}
}
}
Thanks
Targeting An Object Created In A For Loop
Hi all,
Please can you help? I am trying to create new sprites inside a for loop, I then want the sprite that I hover over to get bigger. At the moment all the sprites are scaling together and not just the one I hover over.
Im guessing it is because I am not giving each Sprite an different variable name but Im not sure how to do this inside a for loop. Does anyone know the solution?
Heres the code:
Code:
package com.edition.slideshow
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
public class SlideShowTest extends Sprite
{
public function SlideShowTest ()
{
for (var i:int = 0; i < 2; i++)
{
var hoverIndicator:Sprite = new Sprite;
hoverIndicator.graphics.beginFill(0xFF0000, 0.5)
hoverIndicator.graphics.drawRect(0,0,30,20)
hoverIndicator.graphics.endFill()
addChild(hoverIndicator)
hoverIndicator.x = 200 * i
hoverIndicator.addEventListener(MouseEvent.MOUSE_OVER, hoverHandler);
}
}
private function hoverHandler(event:MouseEvent):void {
this.scaleX = 2
}
}
}
Managing Instances Created By Loop
I am making a small item trading game where the player moves from store to store trying to buy low and sell high. The mechanism for this is a backpack system similar to the game Diablo... Basically a store is a 6x5 grid, the player's backpack is a 3x4 grid, and the items are either 1x1 or 2x2. The store, and player inventories are just arrays with item names.
When the player arrives at a store I read the inventory arrays, and use a loop to create instances of the various inventory item objects. The player sees the store grid, and the backpack grid with these instances. They can move items from one to the other freely, each time an object is dropped from the store to the backpack, or vice versa, the inventory arrays are updated.
I have my code working to read the arrays, and populate the store grid. But I can't figure out how to manage the instances. I globally define a variable that is referenced to a linked object at the start of my AS:
var _inventoryItemTypeA = InventoryItemTypeA_mc
Then, when the loop reads that the inventory array is full of, say 5 of these... I do like this:
var _itemsPlaced:Number = 0
if (_itemsPlaced < _storeInventory.length)
{
_inventoryItemTypeA.addEventListener(blahblah)
_inventoryItemTypeA = new InventoryItemTypeA_mc
addchild(_inventoryItemTypeA)
_inventoryItemTypeA.x = blah
_itemsPlaced = _itemsPlaced + 1
}
So, it places all my stuff. But it is clear that the addEventListeners and the removeChild stuff I haven't written needs to know how to tell the different instances apart... I can't figure out where to look.
Answers are good- but I'd be just as stoked if I was pointed to the right tutorials. I am the suck at finding the right tutorials.
Thanks,
T
Referencing Objects Created With A Loop
I know there is simple answer here but Im getting tired so here I am.
I am creating buttons for a menu dynamically based on the amount of items in an array. I can create the buttons and labels for them and even make them access their corresponding page that they link to. My question is for the rollover effect, when I roll over I want the text on the button to shift to the right, but because all the buttons were added in a loop I can only reference the last button created.
I think my question is how do I change the instance name of an object? I though .name did it but that doesn't seem to change the actual reference name of an object.
here is what I have:
Code:
for(i=0; i <= numPages - 1; i++){
var menubut:MovieClip = new menuBut();
menubut.name = "b"+(i + 1);
menubut.y = 10 + i * 20;
menubut.pageTitle.text = pages[i];
menubut.addEventListener(MouseEvent.CLICK, changePage);
menubut.addEventListener(MouseEvent.MOUSE_OVER, overMenu);
menubut.addEventListener(MouseEvent.MOUSE_OUT, offMenu);
menucon.addChild(menubut);
}
function overMenu(event:MouseEvent):void{
temp = event.target.name;
menucon[temp].pageTitle.x += 3;
}
function offMenu(event:MouseEvent):void{
temp = event.target.name;
menucon[temp].pageTitle.x -= 3;
}
pages is the array and numPages is the length of that array. menucon is the mc that all the menu buttons go into.
For Loop-created MC Targeting Problems
Here's the code:
desktop0_x = 22;
desktop0_y = 10;
desktop1_x = 22;
desktop1_y = 45;
for (var n=0; n<xmlDoc_xml.firstChild.childNodes.length; n++) {
pref_pane.attachMovie("prefs_thumb_holder", "thumb" + n, n );
target = pref_pane.getInstanceAtDepth(n);
target_x = ["desktop" + n + "_x"];
target_y = ["desktop" + n + "_y"];
target._x = desktop1_x; //THIS LINE "WORKS"
target._y = target_y; //THIS IS WHAT I WANT
trace(target_x);
}
The first bold line i a way to force the code to work, but it destroys the beauty of a for loop. How do I write the code that says the following:
movieClip[n]._x = desktop[n]_x;
I'm totally stuck at this point! Help!
Multiple CreateEmptyMovieClips Created Through For Loop Issue.
Hi everyone. I'm trying to use a for loop to create movie clips that are populated with words to drag around and place somewhere. When I create the movie clips, only the last one shows up. Here is my code, maybe someone can tell me what I'm doing wrong. (I'm almost certain that the other movie clips are being overwritten for some reason).
code:
cat1 = new Array();
cat1 = ["Shirt","Pants","Hoodie","Tie","Socks","Underwear" ,"Glasses"];
for(i=0;i<cat1.length;i++){
this.createEmptyMovieClip("word"+i,this.getNextHig hestDepth);
this["word"+i].createTextField("wordtext"+i,this.getNextHighestD epth,i*20,i*20,100,50);
this["word"+i]["wordtext"+i].text = cat1[i];
this["word"+i].onPress = function(){
this.startDrag();
}
this["word"+i].onRelease = function(){
this.stopDrag();
}
}
I hope someone can help me with this. And I'm sure its something stupid I'm missing.
Adding A Function To An Object Created By Loop
Well, I've been having quite a bit of trouble with this (atleast it looks easy) easy script.
My main goal is to first create a few thumbnails, one next to eachother from an XML document (thus, the numberOfSlides parameter) and to add to those thumbs, a rollOver function to...well, act like any other rollOver would.
Now the script that inside the enterFrame has been mostly butchered from my attempts...but from what I gathered, all that script would do was to either only have the rollOver work for the last object created or have the enterframe fail miserably and simply work the trace around 4 times (= to the numberOfSlides apparently).
Code:
function creerSlides(numberOfSlides)
{
var positionX:Number = -30;
for (var x=1; x<=numberOfSlides; x++)
{
_leMenu = _root.clipCible
_leMenu.attachMovie("menuThumbs", "menuThumb"+x, _leMenu.getNextHighestDepth());
_leMenu["menuThumb"+x]._x = positionX;
positionX += _leMenu["menuThumb"+x]._width + 10;
currentSlideNode = slides_xml.firstChild.firstChild.childNodes[x-1];
modifyThumbs(x, slideShowName , currentSlideNode)
//Calls a function which loads pictures into the thumbs...
_leMenu["menuThumb"+x].onEnterFrame = function()
{
trace(this);
/*if(_leMenu["menuThumb"+this.x].hitTest(_root._xmouse, _root._ymouse))
{
trace("Stuff!");
}*/
}
}
}
Could someone give me a hand? I'm at my wits end -.-
Edit: Silly me, calling it an object. It's more of Adding a function to a movieClip added by loop(it already existed in my library, which is why I don't use createEmptyMovieClip or anything like that)...
Dynamic Control Over Loop Created Movieclips
I'm trying to create a series of movie clips from a for loop (so that I don't have to declare and add each one manually) than I can then control individually.
I've found a forum article here: http://www.actionscript.org/forums/s....php3?p=758089
This seems like it would work well with Actionscript 2, but I can't get it to work with Actionscript 3, where most everything deals with addChild and all my manuals declare movieclips as their own custom classes.
Actionscript 3 has me very confused. Anybody know how to update the aS 2 solution?
Text Boxes Created In For-loop End Up Using DIFFERENT Fonts
I have a for-loop that creates movieclips with text boxes inside them, all inside an accordion component. Basically, the code fills the accordion with navigation content.
Anyway, the strange thing is the resulting text fields use TWO different fonts! how is this possible? Even if my TextFormat fails for some reason, shouldn't it then fail for ALL created text fields and not just some (and why does it fail)?
Attach Code
...
var txtFormat:TextFormat = new TextFormat();
txtFormat.align = "left";
txtFormat.font = "Arial";
txtFormat.size = 12;
txtFormat.indent = 0;
txtFormat.bold = false;
txtFormat.color = 0x000000;
for (var o:Number = 0; o<=8; o++) {
for (var i in eval("menu"+o+"_array")) {
// menuACC is an accordion component
menuAcc["menu"+o].createEmptyMovieClip("btn"+i, menuAcc["menu"+o].getNextHighestDepth());
...
menuAcc["menu"+o]["btn"+i].createTextField("lbl", menuAcc["menu"+o]["btn"+i].getNextHighestDepth(), 4, 4, menuAcc["menu"+o]["btn"+i]._width-20, 25);
menuAcc["menu"+o]["btn"+i].lbl.selectable = false;
menuAcc["menu"+o]["btn"+i].lbl.antiAliasType = "advanced";
menuAcc["menu"+o]["btn"+i].lbl.setTextFormat(txtFormat);
menuAcc["menu"+o]["btn"+i].lbl.text = eval("menu"+o+"_array")[i].header;
}
}
...
Problem With Function Dynamically Created In A Loop
Hi, the project is to create a thumbnail picture dynamically from a xml file and display the big picture with the event onPress. My problem is that I create dynamically a function onPress for each thumbnail and inside the function the name of the picture to load. I get no error but the picture loaded is always the last one of the loop. Where is my mistake ? Is there a workaround ?
Any help will be welcome. I have work hard on this but have no more idea. Thanks a lot for you reply
Attach Code
import mx.xpath.XPathAPI;
PictureList = new XML();
PictureList.ignoreWhite=true;
PictureList.load("pictures.xml");
PictureList.onLoad = function(success){
if(success){
tmpFile = mx.xpath.XPathAPI.selectNodeList(PictureList.firstChild,"/album/picture/file");
tmpTitle = mx.xpath.XPathAPI.selectNodeList(PictureList.firstChild,"/album/picture/title");
tmpFormat = mx.xpath.XPathAPI.selectNodeList(PictureList.firstChild,"/album/picture/format");
//trace (tmpFile.length);
var colonne = 0; //j'initialise le nombre de colonne
var ligne = 0; //j'initialise le nombre de ligne
for (var i=0; i < tmpFile.length; i++)
{duplicateMovieClip(thumbNailAnim, "vignette"+(i+1),_root.getNextHighestDepth());
thumbNailName = eval("vignette"+(i+1));
if (colonne == 2) { //si colonne =2 alors on change de ligne et on reprend à la colonne 0
colonne = 0;
ligne++;
}
_root.thumbNailName._x = 75 + (colonne*100);
_root.thumbNailName._y = 80 + (ligne*110);
colonne++;
_root.thumbNailName.thumbNailText.Text.text = tmpTitle[i].firstChild.nodeValue;
_root.thumbNailName.thumbNailBitmap.loadMovie(tmpFile[i].firstChild.nodeValue);
var format:String = tmpFormat[i].firstChild.nodeValue;
_root.thumbNailName._visible = false;
_root.thumbNailName._alpha = 60;
_root.thumbNailName.onRollOver = function() {
this._alpha = 100;
this.thumbNailBorder._xscale = 103;
this.thumbNailBorder._yscale = 103;
}
_root.thumbNailName.onRollOut = function() {
this._alpha = 60;
this.thumbNailBorder._xscale = 100;
this.thumbNailBorder._yscale = 100;
}
_root.thumbNailName.onPress = function(){
_root.imageBox_mc.loadMovie(i+"_big.jpg");
//trace(i);
gotoAndPlay("bigImage");
}
}
}
}
Function Only Working On Last MovieClip Created Within Loop;
Hi all,
As the title suggests, I cant get function at end of the code to attach to each MovieClip I create dynamically within a loop.
Only the last image will follow the mouse. What am I doing wrong? Im really not sure.
Code:
//now do something with the xml data
PopulateLists = function(final_array)
{
for (var i=0; i<final_array.length; i++)
{
//tell the loop we are about to retrieve the attributes of each line in the xml
var banner = final_array[i].attributes;
//retrieve all the atributes from each array instance
var strA;
strA = banner.conttext;
//trace("strA= "+strA);
var intB;
intB = banner.xcord;
//trace("intB= "+intB);
var intC;
intC = banner.ycord;
//trace("intC= "+intC);
var intD;
intD = banner.wdth;
//trace("intD= "+intD);
var intE;
intE = banner.hght;
//trace("intE= "+intE);
var intF;
intF = banner.fntsize;
//trace("intF= "+intF);
var intG;
intG = banner.txtrot;
//trace("intG= "+intG);
var intH;
intH = banner.txtcol;
//trace("intH= "+intH);
var intY;
intY = banner.layer;
//trace("strZ= "+strZ);
var strZ;
strZ = banner.path;
//trace("strZ= "+strZ);
//format the style of the text (doing it for each instance so individual text sizes and rotations can be set
TextStyle = new TextFormat();
TextStyle.color = intH;
TextStyle.bullet = false;
TextStyle.underline = false;
TextStyle.font = "MyFont";
TextStyle.size = intF;
//now create a text field for each line in the xml
if(strA)
{
_root.createTextField("TextBox"+[i],getNextHighestDepth(),intB,intC,intD,intE);
this["TextBox"+[i]].multiline = false;
this["TextBox"+[i]].wordWrap = false;
this["TextBox"+[i]].border = false;
this["TextBox"+[i]].wordWrap = true;
this["TextBox"+[i]].embedFonts = true;
this["TextBox"+[i]].selectable = false;
this["TextBox"+[i]].text = strA;
this["TextBox"+[i]]._rotation = intG;
this["TextBox"+[i]].setTextFormat(TextStyle);
}
//now lets create the movieclips for the images
if(strZ)
{
_root.createEmptyMovieClip("ImageHolder"+[i],intY);
this["ImageHolder"+[i]].loadMovie(strZ);
this["ImageHolder"+[i]]._x = intB;
this["ImageHolder"+[i]]._y = intC;
this["ImageHolder"+[i]].width = intD;
this["ImageHolder"+[i]].height = intE;
moveMC(this["ImageHolder"+[i]],1944,50);
}
}
}
function moveMC(strName,intCenter,intSpeed)
{
onEnterFrame = function()
{
trace("strName: "+strName);
trace("intCenter: "+intCenter);
trace("intSpeed: "+intSpeed);
if (_root.mainVar == 0)
{
homeX = (-_root._xmouse*3)+1944;
}
else
{
homeX = (-_root.mainVar*3)+1944;
}
thisX = strName._x;
diffX = homeX-thisX;
if (_root.mainVar == 0)
{
moveX = diffX/50;
}
else
{
moveX = diffX/5;
}
strName._x = thisX+moveX;
}
}
Removing Objects Created Through Simple For Loop?
ActionScript Code:
private var newHolder:FunkyShape;for (var i:int = 0; i < 10; i++) { newHolder = new FunkyShape(); newHolder.x = i*100;}
How do I delete all 10 of these? Can't figure this out
removeChild(newHolder) doesn't work...
Trouble Loading Into Clips Created By For Loop, Help
Anyone have any ideas why this won't work?
ActionScript Code:
var base:MovieClip = this;// initiatefunction init():Void{ base.createEmptyMovieClip("thumbsContainer", 1000); loadThumbs();}// load thumbsfunction loadThumbs():Void{ for (var i:Number=0; i<images.length; i++) { var t:MovieClip = thumbsContainer.createEmptyMovieClip("thumb"+i); t._x = i * 40; var src:String = images[i].attributes.thumb; thumbLoader.loadClip(src, t); }}
The first dynamically created clip, thumbsContainer, is there because I am able to load an image into it. The srcs are correct as I have checked them with a trace. So why would this not be working?!
Determining Previous Text Field Created By A For Loop
I am looping through and XML file to create dynamic text fields that contain the name of the link, I am getting everything added to stage but i run into the problem of positioning the text field that is being created below the previous text filed.
in my for loop i tried creating a variable j = i-1 it works fine with positing the first text filed but then when i try to position the second field being created i get this error. Am I even going about this the right way? is their an easier way of getting the properties of the previous text filed that was created?
Code:
Movie Loaded, movie on
ReferenceError: Error #1069: Property 0 not found on flash.text.TextField and there is no default value.
at Landing_v2_003_fla::menu_5/buildFile()
at Landing_v2_003_fla::menu_5/onXMLComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
here is my code
Code:
stop();
var myXML:XML;
var linkList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
var xmlRequest:URLRequest = new URLRequest("demoMenu.xml");
xmlLoader.load(xmlRequest);
xmlLoader.addEventListener(Event.COMPLETE, onXMLComplete);
function onXMLComplete(e:Event):void
{
myXML = new XML(e.target.data);
linkList = myXML.children();
removeEventListener(Event.COMPLETE, onXMLComplete);
buildFile();
}
function buildFile():void
{
title_txt.htmlText = "<b>" + myXML..attribute("title") + "</b>";
title_txt.selectable = false;
title_txt.multiline = false;
title_txt.autoSize = "left";
//define links format
var linksFormat:TextFormat = new TextFormat();
linksFormat.align = "left";
linksFormat.bold = true;
linksFormat.font = "Verdana";
linksFormat.color = 0xFFFFFF;
linksFormat.indent = 10;
//addlinks
for(var i:int = 0; i < linkList.length(); i++)
{
var links_txt:TextField = new TextField();
//set the properties
links_txt.name = "links_txt" + i;
links_txt.selectable = false;
links_txt.multiline = true;
links_txt.wordWrap = true;
links_txt.autoSize = "left";
links_txt.width = 130;
//links_txt.y = i*20+50;
//set the text and add it to the stage
links_txt.htmlText = "<b>" + linkList[i].attribute("linkName") + "</b>
";
var j:int = i-1;
if(j == -1)
{
links_txt.y = 50;
}else{
links_txt.y = links_txt[j].height + links_txt[j].y+15;
}
links_txt.setTextFormat(linksFormat);
addChild(links_txt);
}
}
Problems With Nested Variables In Functions Created With A For Loop
I'm having trouble getting the attachmovie scripts below. I'm not really sure why, but I'm guessing the variables are resolving incorrectly. The traces are correct however.
Code:
function createSub (j) {
var capOn = "cap" + j;
var newCapOn = "cap"+ j + "b";
var curMcButton = this["mc_button"+j];
trace("this is j " + j);
trace("this is capOn " + capOn);
trace("this is newCapOn " + newCapOn);
//trace(curMcButton);
// buttons with captions
_root["mc_button"+j].onRollOver = function (capOn, newCapOn) {
this.attachMovie(capOn, newCapOn, this.getNextHighestDepth());
}
this.curMcButton.onRollOut = function (newCapOn) {
trace(newCapOn);
this.newCapOn.removeMovieClip();
}
if (j<=4) {
curMcButton.onPress = function (j) {
removeCaps ( j, 1);
}
} else {
curMcButton.onPress = function (j) {
removeCaps ( j, 2);
}
}
};
for ( j=1; j <= 8; j++) {
createSub(j);
trace(j);
}
Any help is greatly appreciated.
Setting Dynamicaly Created Movie Visable In Loop
I have a loop which, from an array, attaches a new movie for each array value. I need to set all the visable state to false, but I keep geting errors:
Here the loop:
Code:
for(i=0;i<array.length;i++){
mc = _root.attachMovie("theClip", "myClip"+i, _root.getNextHighestDepth());
mc.theSubSmiley.loadMovie(array[i]);
[myClip+i]._visible = false; <------------------error !!myClip0, myClip2, myClip3.. ect ect...
}
How can I set each movie as the loop attaches movies?
Keeping The Data Parameter Of The Object Created With A While Loop
guys,
i've been struggling with the following:
i am creating a list of buttons with an attachMovie. the AS is :
//as
var i = -1;
while(++i<userlist.length){
var user = userlist[i];
var username=user.name.value;
y=i*spacing;
var name = "userInfo"+i;
//creating new object for each button
ob = new Object();
if(user.attributes.moderator){
var temp= username +"[Boss]";
}else {
var temp = username;
}
ob.label=temp;
ob.data=username;
//attach the userInfo(button_mc) for each individual in the array)
_root.userList.attachMovie("userInfo", name , i);
_root.userList[name]._y=y;
_root.userList[name].userName.text=temp;
okay the problem is this: then i assign an on click function to every button right in the while loop that uses the data parameter of the "ob" object and when i play the movie the data parameter is always the parameter of the last object created for all the buttons. I know why this is happening- it overWrites the old "ob" with the new with every itteration of the loop.
But how would i go differently about creating an individual "ob" for each button created and still be able to have a function with a data parameter like this.onRelease.userClicked(data)??
Huge thanks to anybody who can help me out i spent a lot of time trying different things but didn't get anywhere.
Artom
like ob[i] or something like that
AS3 - Multiple ColorTransform Object Instances Not Created In Loop.
I thought this would be simple but for some reason I'm having all kinds of problems. Why won't the for loop create a new c instance each time the loop increments, like it does for sHolder and s? ...And, assuming it is possible to make it do this, how can each instance be given an identifier that can be accessed dynamically, like sHolder and s in the traceSomething function?
Code:
package {
import flash.display.Sprite;
import flash.geom.ColorTransform;
import flash.display.Shape;
public class ColorTest extends Sprite{
private var sHolder:Sprite;
private var s:Shape;
private var c:ColorTransform;
public function ColorTest(){
for(var i:uint = 0; i < 5; i++){
sHolder = new Sprite();
sHolder.name = "sHolder" + i;
addChild(sHolder);
sHolder.x = 50;
sHolder.y = 25 * i;
s = new Shape();
s.name = "s" + i;
s.graphics.beginFill(0xFFFFFF,1);
s.graphics.drawRoundRect(-10, 10, 20, 20, 4, 4)
s.graphics.endFill();
sHolder.addChild(s);
c = new ColorTransform();
c = sHolder.transform.colorTransform;
c.redOffset = -50;
c.blueOffset = -150;
c.greenOffset = -255;
sHolder.transform.colorTransform = c;
}
traceSomething();
}
public function traceSomething():void{
for(var i:uint = 0; i < 5; i++){
var t:Sprite = getChildByName("sHolder" + i) as Sprite;
trace(t.name);
trace(t.getChildByName("s" + i).name);
}
}
}
Fingers
Keeping The Data Parameter Of The Object Created With A While Loop
guys,
i've been struggling with the following:
i am creating a list of buttons with an attachMovie. the AS is :
//as
var i = -1;
while(++i<userlist.length){
var user = userlist[i];
var username=user.name.value;
y=i*spacing;
var name = "userInfo"+i;
//creating new object for each button
ob = new Object();
if(user.attributes.moderator){
var temp= username +"[Boss]";
}else {
var temp = username;
}
ob.label=temp;
ob.data=username;
//attach the userInfo(button_mc) for each individual in the array)
_root.userList.attachMovie("userInfo", name , i);
_root.userList[name]._y=y;
_root.userList[name].userName.text=temp;
okay the problem is this: then i assign an on click function to every button right in the while loop that uses the data parameter of the "ob" object and when i play the movie the data parameter is always the parameter of the last object created for all the buttons. I know why this is happening- it overWrites the old "ob" with the new with every itteration of the loop.
But how would i go differently about creating an individual "ob" for each button created and still be able to have a function with a data parameter like this.onRelease.userClicked(data)??
Huge thanks to anybody who can help me out i spent a lot of time trying different things but didn't get anywhere.
Artom
like ob[i] or something like that
How Can I Disable Loop Created By Timeline Effect In Mouse Over Button
Hi,
A noob question (quess i'm in the right forum then)
Pretty much same as title. I created a button and used to mouse over effect. Then added a timeline effect, question is how do i disable the loop ?
bellow is the animation I'm talking about.
Move your mouse over the text to see what I mean.
<a href="http://www.badongo.com/vid/874168"> http://www.badongo.com/vid/874168</a>
Purchase Already Created Buttons
Hey Folks,
Just picked up Flash MX a few days ago. So far, so good.
I'm hoping ya'll can help me out. I'm looking for a
company who sells flash buttons - something I can open
right up in Flash MX and use as a button with no tracing
or drawing. Specifically, I'm looking for county boundaries
for the USA.
Does anybody know of such a company?
Does anybody know of a simple way to create "county" buttons
without having to trace all of them?
Thanks for your help.
On Release With XML Created Buttons
I am duplicating symbols and in htat symbol there is a button I would like ot place actions on. I have the actions placed but it is not identifying which button it is so I am creating a var id and and placing that on the clip but I can not acces it the AS is below? any ideas...
ActionScript Code:
box_999._visible = false;
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("news/news.xml");
function loadXML(success) {
trace(this);
loaditems();
}
loaditems = function () {
trace("GOT INSIDE");
spacebetweenmovies = 4;
spacing = (i*spacebetweenmovies);
startpoint = (i*95);
nextmovieclipgoes = startpoint+spacing;
trace("nextmovieclipgoes="+nextmovieclipgoes);
duplicateMovieClip(box_999, ["box_"+i], i);
this["box_"+i]._x = 0;
this["box_"+i]._y = nextmovieclipgoes;
if (xmlData.firstChild.childNodes[i].childNodes[4].firstChild.nodeValue != undefined) {
this["box_"+i].body_txt.htmlText = xmlData.firstChild.childNodes[i].childNodes[4].firstChild.nodeValue;
}
this["box_"+i].headline_txt.htmlText = xmlData.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue;
this["box_"+i].date_txt.htmlText = xmlData.firstChild.childNodes[i].childNodes[5].firstChild.nodeValue;
loadMovie(xmlData.firstChild.childNodes[i].childNodes[3].firstChild.nodeValue, "box_"+i+".img_loader");
this["box_"+i].id = i;
this["box_"+i].more_btn.onRelease = function() {
id = this.id
trace("id = "+this.id);
trace("button hit CALLED");
getURL(""+xmlData.firstChild.childNodes[id].childNodes[1].firstChild.nodeValue, "_blank");
};
i++;
if (xmlData.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue != undefined) {
loaditems();
}
};
//////
i = 0;
Buttons Created Dynaimcally, - How To Tell Which One You Pressed?
I have some dynamically created buttons in the content of the scrollpane component !
The code i from frame 1 in the content movieclip:
for (i=0; i<_root.data4.length; i++) {
attachMovie("lilleven", "bat"+[i], i+(_root.data4.length)+2);
setProperty("bat"+[i], _x, (i*85));
if (i == 0) {
myColor = new Color("bat"+[i]);
myColor.setRGB(0xff0000);
_root.teksten = _root.data4[i].tekst;
}
attachMovie("lilleven", "att"+[i], i+2);
setProperty("att"+[i], _xscale, "40");
setProperty("att"+[i], _yscale, "30");
loadMovie(_root.data4[i].image, "att"+[i]);
setProperty("att"+[i], _x, (i*85));
setProperty("att"+[i], _y, -21);
_root.scrollholder.scrollpaneholder.refreshPane();
}
stop();
It creates the content for the scrollpane actually 2 different grafixs, - the bat and the att.
I works perfectly, but the "bat"+[i] is a button, - because I want the user to be able to select one of the clips and then get some information about it.
So I have a picture, with a button on top, - it works fine too, - BUT...
How do I assign any actions to a button that's dynamically created??
And how do I find out which button in the scroller I have pressed??
Regards
Godowsky
Unloading Dynamically Created Buttons?
Hi
Actionscript 2
Flash MX 2004 Pro
Im making a dynamically created menu system. My first Master button is creating 6 sub buttons. My second Master button is creating 5 sub buttons in the same area but the 6th sub button from the first Master button is still visible underneath. Basically i need to unload all sub buttons every time I click a Master button. Is there an easy way to unload all movies in a level. I think the sub buttons are on level 1.
My frame code is
Code:
var section1Names = new Array();
section1Names[0] = "Section1_1";
section1Names[1] = "Section1_2";
section1Names[2] = "Section1_3";
section1Names[3] = "Section1_4";
section1Names[4] = "Section1_5";
section1Names[5] = "Section1_6";
var section1Count = section1Names.length;
var section2Names = new Array("Section2_1", "Section2_2", "Section2_3", "Section2_4", "Section2_5");
var section2Count = section2Names.length;
var menu = this.createEmptyMovieClip("menu_mc", 1);
menu._x = 180;
menu._y = 120;
and my Master button code is
Code:
on (press) {
for(var i=0; i < section1Count; i++){
var depthCount = menu.getNextHighestDepth();
var item = menu.attachMovie("itemClip", "item_" + i, depthCount);
item.labelName = section1Names[i];
item.targetClip = this;
item._y = i*45;
}
}
many thanks
M
[CS3] I Created A Pre-loader Now My Nav Buttons Don't Work
So, I have this web site that I've put a lot of time and energy into, so...there's a lot of info to load up for the portfolio page and to keep the user interested I created a pre-loader. I up loaded it and tested it...work fine.
The problem is now that when the portfolio page loads up initially, none of the other page links activate. The links for my work works correctly and when I go to an animation or other "work to show " link THEN go back to portfolio, the nav buttons function properly.
If anyone understands what I'm trying to say and can help I'd appreciate it.
Events On Dynamically Created Buttons
With the methode attachMovie I have created n button symbols.
Now I want to add events to each created button, each button reacts different to the event.
How can I do this?
Referencing Dynamically Created Buttons
I am creating a set of buttons from an array of information and need to know how to reference those buttons after they are created. I've clearly got some sort of syntax error and it's driving me nuts.
Here's the function (within a ProdSelectSystem class) that creates the buttons (which works just fine. The buttons work and do what they are supposed to do):
Code:
//--------------------------------------------------------------------
public function doInit(_systemData:Array):Void
{
systemData = _systemData;
listItems = new Array();
attachButtonItems();
}
//---------------------------------------------------------------------
/*
Attach a button clip for each data item in our systemData array
call init() on the new clip passing it an ID and data items
*/
private function attachButtonItems():Void
{
var exportName:String = "mcNLProdButton";
for(var i:Number = 0; i < systemData.length; i++)
{
var item:MovieClip = this.attachMovie(exportName, "Item_" + i, i);
item.init(this, i, systemData[i]);
listItems.push(item);
} //end for
} //end function
The problem comes when I try to reference these buttons later elsewhere. Since the instance name given in the loop via the this.attachMovie is "Item_" + i, I was under the assumption that I could use (for example for the _alpha property of the second created button) _root.Item_1._alpha. When I try that, however, I get "undefined".
I'd appreciate all thoughts on the subject.
TIA,
CP
Convert Dynamically Created MCs Into Buttons... How?
I'm working on a Flash/XML photo album that loads image thumbnails dynamically by creating individual movie clips for each thumbnail. The thumbnails are divided into 10 groups. Every time a new group of thumbnails is selected from the album the XML array is upadated with the correspondig image file name and path. Now, I'd like to make each individual thumbnail_mc a button that when released loads the corresponding photo in the main stage. The first function loads the photo onto the main stage with back and forward buttons. The second function displays the thumbnails as movie clips. And the last function makes the movie clips active as buttons but does not work. How can I fix the last function? Any help is very much appreciated. Thanks!
// Loads actual images and text into empty_mc, content_txt, and comment_txt
function loadPhoto(nodePos:Number):Void {
//trace(GalleryNode.firstChild.attributes.filename);
PhotoNode = GalleryNode.childNodes[nodePos];
var filename:String = PhotoNode.attributes.filename;
var caption:String = PhotoNode.attributes.caption;
mainDisplay.empty_mc.loadMovie("photos/"+selectedGallery+"/"+filename);
// Loads thumbnails as individual mc's, thumbnails is an Array
function thumbDisplay(thumbnails) {
var galleryLength:Number = thumbnails.length;
// loop through each of the images in the gallery_array.
for (var i = 0; i<galleryLength; i++) {
/* create a movie clip instance which holds the image, also sets a variable,
thisMC, which is an alias to the movie clip instance. */
thisMC = this.createEmptyMovieClip("image"+i+"_mc", i);
/* load the current image source into the new movie clip instance,
using the MovieClipLoader class. */
mcLoader_mcl.loadClip("photos/"+selectedGallery+"/thumbs/"+thumbnails, thisMC);
// makes each thumbnail image_mc a button that loads the corresponding photo in the main stage
function thumbButton():Void {
for (var i = 0; i<thumbnails.length; i++) {
thisMC("image"+i+"_mc").onPress = function() {
loadPhoto(i);
}
}
}
Clearing Dynamically Created MC Buttons
I am using if else to load alternative one.as or other.as files to create different sets of MovieClip buttons.
My problem is that I need to clear the presently loaded as file before loading the new one. but HOW?
I am using flash 8 Actionscript2 in the as files to create the buttons and name them dynamically using Array (for the naming) and for(i=0; i< Array.length; i++) for the buttons. The number of buttons are different in each as file and they do load but old buttons do not clear on change.
Thanks for your help in advance.
Convert Dynamically Created MCs Into Buttons
I'm working on a Flash/XML photo album that loads image thumbnails dynamically by creating individual movie clips for each thumbnail. The thumbnails are divided into 10 groups. Every time a new group of thumbnails is selected from the album the XML array is upadated with the correspondig image file name and path. Now, I'd like to make each individual thumbnail_mc a button that when released loads the corresponding photo in the main stage. The first function loads the photo onto the main stage with back and forward buttons. The second function displays the thumbnails as movie clips. And the last function makes the movie clips active as buttons but does not work. How can I fix the last function? Any help is very much appreciated. Thanks!
// Loads actual images and text into empty_mc, content_txt, and comment_txt
function loadPhoto(nodePos:Number):Void {
//trace(GalleryNode.firstChild.attributes.filename);
PhotoNode = GalleryNode.childNodes[nodePos];
var filename:String = PhotoNode.attributes.filename;
var caption:String = PhotoNode.attributes.caption;
mainDisplay.empty_mc.loadMovie("photos/"+selectedGallery+"/"+filename);
// Loads thumbnails as individual mc's, thumbnails is an Array
function thumbDisplay(thumbnails) {
var galleryLength:Number = thumbnails.length;
// loop through each of the images in the gallery_array.
for (var i = 0; i<galleryLength; i++) {
/* create a movie clip instance which holds the image, also sets a variable,
thisMC, which is an alias to the movie clip instance. */
thisMC = this.createEmptyMovieClip("image"+i+"_mc", i);
/* load the current image source into the new movie clip instance,
using the MovieClipLoader class. */
mcLoader_mcl.loadClip("photos/"+selectedGallery+"/thumbs/"+thumbnails, thisMC);
// makes each thumbnail image_mc a button that loads the corresponding photo in the main stage
function thumbButton():Void {
for (var i = 0; i<thumbnails.length; i++) {
thisMC("image"+i+"_mc").onPress = function() {
loadPhoto(i);
}
}
}
Dynamiclly Created Buttons And Script
how can i add my button scripts (rollover, click etc) to a dynamically created movieclip. the dynamic movie then has a library based movie attached to it
ie
createEmptyMovieClip("BUTTON"+i, getNextHighestDepth());
where = 100 + (i * 100);
attachMovie("NAV_BUTTON", "BUTTON"+i , getNextHighestDepth(), {name:elename,_x:where, _y:100});
thanks for any direction
Numbers Of Dynamically Created Buttons
I have started to create my buttons dynamically. When doing so, I would like to have a number for each, that I can use to then call other things, such as text from an array, images, etc. All my assets in this file are numbered. For example, the button that I am creating with the following for loop, will have a string from an array, and a jpg that will load when it is clicked.
This is how I am creating the buttons.
for(var i:Number = 0; i < thumbs; i++){
var ref:MovieClip = thumb_scroller.all_thumbs["thumb" + i];
ref.onRelease = function():Void {
clickAction();
}
};
For example, "thumb_scroller.all_thumbs.thumb5" will, when clicked, load a jpg, called 5.jpg and reference a string from an array, at the 5 place in that array. So, if I could somehow, send the number 5 as a parameter with the clickAction();, I could then do what I want. I had tried something like this clickAction(i); but it did now work, because i got updated until the for loop was done and so had the same value for all buttons created by it. How is this done? Is there a way to create dynamic variable that I can send as a parameter with the clickAction()?
Thanks a lot. Any help would be greatly appreciated!!!
Dynamically Tween Buttons Created From Xml
I have the following code that reads an xml and creates buttons based on the xml.
i can get it so that it places the buttons ok but what i want to do is have the first button appear then the second drops down beneath then the third drops down beneath that etc etc.
The code i have currently sets the first button _y position and then tweens all remaining buttons to the same place beneath the first.
Can anyone show me how to change the code so that each button tweens to a _y position beneath it's previous button.
code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
function buildSub(imageList) {
for (i=0; i<imageList.length; i++) {
mc = _root.attachMovie("button2", "nav"+i, i);
mc._x = 60;
mc._y = 175;
//create text
mc.createTextField("mytext", 1, 0, -2, 0, 15);
mc.mytext.autoSize = "left";
mc.mytext.multiline = true;
mc.mytext.text = imageList[i].name;
//format text
myformat = new TextFormat();
myformat.color = 0xFFFFFF;
myformat.font = "Swis721 Md BT";
myformat.size = 12;
mc.mytext.setTextFormat(myformat);
//set y position of button
if (i>0) {
new Tween(mc, "_y", Bounce.easeOut, 175, _root["nav"+(i-1)]._y+15, 1, true);
}
//button actions
mc.onRollOver = function() {
_root.buttonOver2(this);
};
mc.onRollOut = function() {
_root.buttonOut2(this);
};
}
}
cheers
d
Buttons Created From An Array Dynamically
Last edited by L-Square : 2007-11-13 at 07:23.
Please help with the code below.
I am trying to bring in a variable product_name, split the string by ~, which is currently working, then create a for loop which will create a button for each element in the array.
var productnames:Array = new Array();
productnames = _root.Product_Name.split("~")
var btnnames:Array = new Array();
btnnames[0] = "btnpn1";
btnnames[1] = "btnpn2";
btnnames[2] = "btnpn3";
btnnames[3] = "btnpn4";
for (var i=0; i < productnames.length;i++){
btnnames[i].label = productnames[i]
}
EDIT:
I have tried this code below, however nothing has been drawn on the page at all.
for (var i=0; i < productnames.length;i++){
duplicateMovieClip(emc,btnnames[i],i);
this[btnnames[i]].id = btnnames[i];
this[btnnames[i]].x = 1 + (i * 50);
}
However... nothing was being drawn before
The dynamic movie clip i am currently using is just a simple black movie clip for testing purposes.
Thanks,
L - Square
Help: Adding On Actions To Dynamically Created Buttons
is there any way to do this?
I am loading a series of jpg images into a target MC. Then I am loading a series of invisible buttons to overlay them to make them interactive.
is there any way to set on(mouseaction) events to a button that is created dynamically?
thanks
.fe.
i may not have explained that well, but sometimes it is hard to..
Assigning Variables To Dynamically Created Buttons
Hi
i have made a button in flash mx and give it instance name pics now on the first frame i have put the following code.
i = 0;
while (++i<=5) {
xpos = i*40;
duplicateMovieClip("pics", "nextpic"+i, i);
newName = eval("nextpic"+i);
setProperty(newName, _x, getProperty("newName", _x)+xpos);
}
It duplicates the button 5 times e.i. now i have five buttons on the stage.
My Question is how can i assign some variable on clicking the buttons
(for ex. i want to assign a=1 on but1, a=2 on but2, a=3 on but3....etc.)
Anybody knows how to deal with it.
Passing Link To Dynamically Created Buttons
Hi all,
Can any one tell me how can i pass different links to dynamically created buttons.
I am using this code to duplicate buttons but i am unable to pass some variable when user click on any of the buttons.
i = 0;
while (++i<=4) {
xpos = i*40;
duplicateMovieClip("pics", "nextpic"+i, i);
newName = eval("nextpic"+i);
setProperty(newName, _x, getProperty("newName", _x)+xpos);
}
I think it is understandable.
Thanx in Advance.
Help Remove ALL Dynamic Buttons Created By A Function
I'm sorry if this is a duplicate post. I can't find evidence of my first attempt anywhere.
Please see attached file(s) for reference...
I created a function to attach, name, and position a dynamic button movie clip. I ran the function 5 times to create buttons "choice1", "choice2", etc.
In the next frame, I want to remove all 5 buttons using 5 removeMovieClip commands, but only "choice2" thru "choice5" go away.
My grasp of functions is still fairly fragile. Can you help me figure out what I am missing?
PLS HELP Assigning Loadmovie() To Dynamically Created Buttons
ok... after taking a long break from this file...(been swamped with work recently)...I tried a crack at it again. I can't seem to figure out how to assign onRelease actions to the buttons to make them load external swf files. Now as it turns out... i need to get this working ASAP.
checking out the attached file is probably a good idea to understand what i'm alking about here.
i tried adding this (in red) to where the buttons are set up initially:
code: ymenu_mc.addItem("01 ", {text:" Feature Sheets", data:"item0.swf"});
i did that thinking if i added a statement like this (also in red) to the button/mc actions it would load the movie i defined in data: into and empty mc named test :
code: bg_mc.onRollOver = function() {
_parent.selectItem(id);
};
bg_mc.onRollOut = bg_mc.onReleaseOutside = function() {
_parent.deselectItem(id);
};
bg_mc.onPress = function() {
_parent.clickItem(id);
};
bg_mc.onRelease = function() {
trace(this.ymenu_mc.data)
this.test.loadMovie(this.ymenu_mc.data);
};
// instead of this.ymenu_mc.data i also tried using
// _parent.items_arr[newId].mc.data in place of ymenu_mc.data and a few other similar variations
//each time trace() returns "undefined" as the value
|