Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Setting _levelX Dynamically



Hi,

I am trying to get Flash to recognize the level I want it to act upon. I have for example


Code:
_global.leveltoload = leveltoload + 10;
mypreloader.loadSWF("some.swf", leveltoLoad);
In one of my prototype functions I have


Code:
Preloader.prototype.loadSWF = function(swftoLoad, leveltoLoad) {
this.startPreload();
loadMovieNum(swftoLoad, leveltoLoad);
}
In my startPreload prototype function I have


Code:
Preloader.prototype.startPreload = function() {
this._visible = true;
whichlevel = "_level"+leveltoLoad;
trace("whichlevel: "+whichlevel);
this.onEnterFrame = function() {
bytesloaded = _level10.getbytesloaded();
bytestotal = _level10.getbytestotal();
percent = bytesloaded/bytestotal;
percentdisplay = math.round(percent*100);
this.preloadBar._xscale = percentdisplay;
this.percentOutput.text = percentdisplay.toString()+"%";
if (percent>.99) {
this._visible = false;
whichlevel.gotoandplay("beginMovie");
this.preloadCompleted();
}else{
//keep on loading
}
};
}
My question is this: How can I get flash to recognize whichlevel as being _levelX without hardcoding the value of X? Above I have hardcoded the level on the bytestotal, byteslaoded line, but I really do not want to do this. I want flash to use the whichlevel value and interpret it as being _level10, as in this case.

I have tried all different ways, using string concats, toString(), eval, etc..

Any help would be very much appreciated.



Ultrashock Forums > Flash > ActionScript
Posted on: 2002-09-22


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

_levelX Buttons Dont Work After _levelX+1 Movie Beggins To Scroll
Hola
I figured out how to target a loaded movie from the main timeline... but now something else arose.

in Frame 1 of my Mainmovie
frame 1

loadMovieNum ("doors.swf", 5);
loadMovieNum ("scrollingmenu.swf", 4);

frame 2
stop 0;


I have a button in my Main movie set to control opening and closing the doors

on (press){ _level5["doorAction"].gotoandPlay("close");

}
on (rollOut){_level5["doorAction"].gotoandPlay("open");
}

...I get the doors to open and close ... as scrollingmenu.swf starts scrolling ( depending on mouse posiiton - the scrollingmenu.swf is not even close to the button controlling door.swf) My button on _level0 doesn't react to press or rollOut ...
I dont get it ...


Any suggestions?... =) "Gracci Tanti"

Dynamically Setting Labels Or Dynamically Setting Frames To Print
1. Does anyone know if there is a way to dynamically set a frame label. The reason for this is that I want a particular frame to Print with other frames (requiring a frame label of #p) if you answer a question a certian way and not to print with the other frames (needing a different label or no label at all) if the question is answered differently.

2. Option #2 would be to be able to dynamically set which pages print when you call the "PRINT" command (probulary through an expression). Any ideas would be appreciated.

thanks

_levelx. - Can X Be A Variable?
_levelx. - can x be a variable?

I cant manage to control levels using this technique.

Surely its possible!

No?

_levelX Targeting
hello, I am new to this board :-)
I have been learning basic action script this past week and have run into a problem that the "help" option does not provide info on.

Basically I have a button that when I press it it will attatch a movie clip to a target movie clip that I called "loadTarget". I made all these conditons and everything and it worked fine even when I made a function applying it to many buttons for different things to attatch.

My problem is this: I wanted to see if I can target this "loadTarget" clip if it was on the main timeline of a loaded movie, on another level, say lvl 2. I have a feeling that the problem is in targeting the movie clip instance.

So I looked up targeting movie clips in the help and it says rather than typing the standard _root. to type in _level2. so that it can find the clip on level 2 relative to the main movie...

But it wont attatch the clip! It still cannot find the "loadTarget" clip instance in the loaded movie...

can anyone help me? thanks :-)

LoadMovieNum And _levelX
hello,

I just can not remember how to acces a loaded swf movie on top of another

loadMovieNum( "somemovie.swf" , 10);

_level10.getBytesLoaded()

or

_level10._x+=150;

does not seem to work....

_levelX.gotoAndPlay(2); Please Help
I would like to call on a level num dynamically, like the this:

_level(currentNum).gotoAndPlay(2);

what am I doing wrong?

_levelx.gotoAndStop Problem ...
Hello,

I've a button in level1 with this script:
on (release) {
loadMovieNum ("news.swf", 6);
_level6.gotoAndStop("test");

}


And in my news.swf I've a label "test" in frame 15. It load well the news.swf, but don't jump directly to my label!
I put a stop at frame 15 (where is my label).

Any suggestion?
How do you control a external movie? I'm correct?


Regards, Dominique

_levelx.enabled - Does It Work ?
hi

this is my first post in this great foum !!

i'm loading a swf file on top of another but
I want to disable the lower level so that the buttons
won't work.
I've tried level6.enabled = false but it doesn't work
is there something i'm missing
I guess i could go and disable handCursor and all the buttons on the
lower leve but i was looking for a more universal solution.

any help ??

_levelX, Level Num As A Variable
I would like to know how to call on level nums dynamically, what am I doing wrong?

_level(currentNum).gotoAndPlay(2);
or
["_level"+currentNum].gotoAndPlay(2);

neither of these work

--===Creating Dynamic _levelx Strings===--
--===Creating dynamic _levelx strings===--
Hi.

I am having diufficulty creating dynamic _levelx strings. I am attempting to store ("_level" + x) in an array element(where x is an integer). The array is called levelarray. However when I try to call a function like levelarray.detDepth(); the function call does not work. Why?

One instance of the problem is highlighted in the code below.

Any help is much appreciated.

Thanks

-------------------------------------------------


var levelarray = new array();
var namearray = new array();
var startlevel = 10;
//starting layer
var arraylength = 0;
var firsttime = 0;
function openwindow(windowname, levela, namea) {
trace("new window name: " + windowname);
if (firsttime == 0) {
//if first time window opened
trace("creating new list called "+listname);
loadMovieNum(windowname, ++arraylength+startlevel);

//----------------------------------
//----------------------------------

//load new movieclip into
levela.push("_level" + (arraylength+startlevel));

//----------------------------------
//----------------------------------
//create wlist with layer
trace("newly created list "+[levela]);
namea.push(windowname);
trace("newly created namelist "+[namea]);
firsttime = 1;
//record list created
} else {
// check if window already open
trace("scanning for open windows in an array of length "+arraylength);
check = 0;
for (i=0; i<arraylength; ++i) {
trace(namea+" "+i);
if (namea == windowname) {
check = 1;
trace("window already open. not reopening");
break;
}
}
// no instances of window found
if (check == 0) {
trace("opening window"+windowname);
loadMovieNum(windowname, (++arraylength+startlevel));
//load new movieclip
levela.push("_level" + (arraylength+startlevel));
//add to wlist
trace("appended list"+[levela]);
namea.push(windowname);
trace("list of names "+[namea]);
}
}
}
// moves element at array position 'index' to top
function moveToTop(index)
{
trace("index "+index);
trace("levelarray.length - 1 " + (levelarray.length - 1));
// if already top, don't do anything
if (index == levelarray.length-1) {
return;
}
trace("starting swap");
// remember element in question
var curr = levelarray[index];
trace("curr: " + curr + "depth" + curr.getDepth());
// remove it from the array
levelarray.splice(index, 1);
// move everything else down one level
for (var j = index; j<levelarray.length; j++) {
levelarray[j].swapDepths(startlevel+j);
}
// move current movie clip to top
levelarray.push(curr);
curr.swapDepths(startlevel+levelarray.length-1);
}

-----------------------------------------------------------

Setting A Variable Dynamically
I have a movie which gets loads of external variables from a DB e.g.
ename[0]="bob", email[0]="fred@test.com", numRows=12
i then have a movie which contains a variable called 'address' (this movie will be a getURL mailto command when it starts working)

now when the data dls i can update the 'address' variable by saying _root.mov.address=numrows but when i say _root.mov.address=email[0] it just doesn't work.

this is a fundamental problem i've been tackling a lot recently all i want to do is be able to init a maito command to users in my DB but having real probs - any ideas?

Dynamically Setting Tint
Is it possible to dynamically set tint?

HELP Dynamically Setting Variable Name?
Please can anyone help me,

i have a username input box called "user" and i need to somehow dynamically create a new variable which gets its name from whatever is typed into "user"

is there any way i can do this?

Problem Setting Dynamically
Hey Guys,

I'm having a problem setting variables dynamically

I have 1 MC and 1 Button, with many instances and names on the stage

below is the script inside the buttons ... so it corrispons to all the buttons on the stage ... thats why I'm using "_name"
code:
gotoAndStop("on");

for (i = 1; i <= _name.length; i++) {
if (_name.charAt(i) == "_") {
currentTextField = _name.substring(0, i);
currentStyleFormat = _name.substring(i+1, _name.length)
}
}
currentTextFieldF = currentTextField+"_Format";
set("_root."+currentTextFieldF+".bold", true)

trace(currentTextFieldF)
trace(currentTextField)
trace(currentStyleFormat)

if (currentTextField == "textField1") {
_root.textField1.setTextFormat(_root.textField1_Fo rmat)
} else if (currentTextField == "textField2") {
_root.textField2.setTextFormat(_root.textField2_Fo rmat)
} else if (currentTextField == "textField3") {
_root.textField3.setTextFormat(_root.textField3_Fo rmat)
} else if (currentTextField == "textField4") {
_root.textField4.setTextFormat(_root.textField4_Fo rmat)
}


any way I don't want to use the if else if stataments ... cause I don't know how many buttons there are going to be in total ...

I want to simplfy everything like this code

code:
set("_root."+currentTextFieldF+".bold", true)


I've tried eval

code:
eval("_root."+currentTextField+".setTextFormat(_ro ot."+currentTextFieldF+")")


and I've tried set()

code:
set("_root."+currentTextField+".setTextFormat(_roo t."+currentTextFieldF+")", true)


Nothing seems to work ... can anybody help me

thanks

Combobox Dynamically Setting
This is working but doesn't trigger once dynamically opened and highlighted and selected...How do I get it to fire...It only fires when I physically click on it...

this.MCL_menu.myComboBox.open();
_root.MCL_menu.myComboBox.selectedIndex = _root.MCL_menu.myComboBox.length-5;

Many thanks!
=)

Setting Up Buttons Dynamically...
I have 25 buttons in a game labelled "button1" through to "button25", that all need to call functions when they are pressed, released and rolled over. Rather than go onto each one and add the code one by one actually on the button, I thought I'd be clever and do the following to try and set it all up with one neat bit of code:


ActionScript Code:
// set up the buttons
function intButtons () {
    for (i = 1; i <= 25; i++) {
        this["button" + i].onPress = function () {
            pressBtn (i);
        };
        this["button" + i].onRelease = function () {
            releaseBtn (i);
        };
        this["button" + i].onRollOver = function () {
            rollOverBtn (i);
        };
    }
}
// function to handle pressing a button
function pressBtn (which) {
    trace ("PUSH " + which);
}
// function to handle releasing a button
function releaseBtn (which) {
    trace ("RELEASE " + which);
}
// function to handle rolling over a button
function rollOverBtn (which) {
    trace ("OVER " + which);
}

But... when I test it, what I get on every button is "PUSH 26", "RELEASE 26", or "ROLLOVER 26", it's always 26, rather than each button's correct number. So what's happening is it's always using the current value of "i" from the for loop, rather than the value it was when I set up each button.... if you get my meaning.

Is there a way to make this work properly without writing it all out one by one for each button?
Cheers.

Setting Array Dynamically
Im looking for the correct syntax to set the values of this array as dynamic vars

a[0] = {x: 1991, y1: 3, y2: 10};

how do i set the values of x, y1, y2 dynamically


a[0]={x: dynx,y1:dynY,y2: 10}; ??

Do i need an Eval ?

Cheers,

Biffer
www.ifdnrg.com

Setting Variable Names Dynamically
Hi
I'm loading one swf (15 times) into 15 movie clips and setting a variable within that swf (as it is loaded) as a number - so each time the swf is loaded in it has a variable called 'eventnumber' set as 1 or 2 or 3 etc...

Now that movie clip is has a set of variable text fields within it called eventdescription, eventdate etc. On the _root timeline a txt field is loaded in with a string of variables like eventdescription1=whatever&eventdescription2=somet hingelse etc... If I then write a script within the swf that is loaded in that reads

tellTarget ("_level10/ievent/ipicture"+eventnumber+"/i1/i2") {
eventdescription = _root.eventdescription2;
}

Setting The Min And Max Scroll Of A Movieclip Dynamically?
Hello...

I have a movieclip below a mask. You can scroll the movie clip up or down.

The movieclip will vairy in size, so I need a way of setting a max level to which the movieclip can not be scrolled beyond.



I can set the maxscroll by just entering a number, but this is no good because the movieclip changes size.

How can I get the size of the movie clip, then not allow you to scroll beyond the bottom or top of that movie clip.

Thanks,
Mark

Dynamically Setting Text Size
The actionscript tells me, textField.textSize = 10

which i'm sure would work, but what if you dynamically create a text field

when you do this, you set the variable name for the text field, but some how I can't seem to get the textSize to work :/


PHP Code:



this.loader.loadProgress_txt.textSize = 4;
this.loader.loadProgress_txt.textColor = 0xFFFFFF;




the color property works, but no the text size, whats up?

Setting Accessibility Info Dynamically?
Hey All,

Any plans from MM to make accessibility dynamicly settable? i've spent the last couple of months making an app which is multilingual and i can only set the accessibility info to 1 string.

If the solution to it is to create clips with the info loaded and then attach them... then the best is to remove viewers from flash and display info in a HTML page which can get read properly, no?

thanks, A.

Setting Interval Dynamically And Clearing --wtf?
hit1.onPress=function(){

//clearAllTimeouts()
this._visible=0
openingBox=true

//tell zoomer where to go -- zoom
for(i=0;i<=gridItems01.length;i++) {

int[i]=setInterval(gridItems01[i],"mcZoom", 40, gridItems01[i].targetX, gridItems01[i].targetY,
gridItems01[i].speed, gridItems01[i].targetWidth,
gridItems01[i].targetHeight,3)
}


}

Here's a script I have for a button that runs through a series of arrays and sets an interval. Can you set the interval dynamically i.e. int[i]? Because I can't seem to clear the intervals after it's been set. Basically I want a seperate interval for each of the mc values in gridItems01[i] and be able to clear them later.

Dynamically Setting The Size Of An Mc Using Textlength
Hi - I attach an MC to the _root and then a textbox to that MC, format the textbox and set the box to equal some text. The text is dynamically set, so it can be a varying amount of sizes. The background attached MC is a fixed size that I wish to resize to the size of the textbox once the text is loaded.

I have tried using textboxholder._width = textboxholder.pageTitle.textWidth; but the background mc resizes incorrectly.

Any help or ideas?

frank

Dynamically Setting Vars With A Type
Does anyone know if this is possible I want to create variables dynamically - which you use set command however this does not allow for a type definition (keeping consistent with AS2) I know set command been around for a while - does anyone know of another command or a way to associate a type explicity in AS2?


Or is it just a case of whatever you assign to it is you cast the vars?

Dynamically Setting Alignment Of Textboxes
Hi,

I have two fla/swf files: engine.swf and star.swf.

Engine.swf loads star.swf into a movieclip (mc) that is on it's timeline.

Star.swf has a movieclip (abc) with a textbox in it. I named this textbox itemdata and has a width of 200 and a height of 100. I set the var of the textbox to grab the data from _level0.itemcontent (off of engine.swf) variable.

On the root of engine.swf. I have:

itemcontent = "Testing";

I want to center this text in the textbox width and height wise dynamically through action script. That is right in the center of 200x100.

How do I do this?

I tried:

mc.abc.itemdata.align = "center";

But that does nothing, the text is still aligned left. I don't know how to set it to center height wise.

Also is it possible to assign the text to the textbox without having to assign the variable in the Var: field in the textbox?

That is, I tried on the root of engine.swf:

mc.abc.itemdata.text = "Test";

That doesn't work.

Please help!!

Thanks.

Dynamically Setting Movie Clip _y
I am using a LoadVars to load two numbers from a MySQL database. I then want to set the _y and _x properties of a movie clip to these numbers. The _x sets fine but the _y does not set to the loaded number. Any ideas?

Dynamically Setting Transformation Point
Hi,

I have a blank movieclip and actionscript loads a jpeg into it. Right now, when the jpeg is loaded in, the registration and transformation point is located on the top left corner of the image. This seems to be the default.

I'd like to keep the registration point in the top left corner of the image but I want to move the transformation point to the center of the image. I need to do this using actionscript as everything is dynamically created and set.

Is this possible and how do I go about doing this?

If this isn't possible, how do I go about loading a jpeg into a movieclip and setting both the registration and transformation point to dead center?

Please help.

Thanks.

PLEASE Problems Setting Components Dynamically
Hi,

We are beginners to Flash/ASS and we are creating an application like a presentation, where you are able to go to NEXT and PREVIOUS pages. These pages are frames in the timelime and we have only some frames like templates.
If we need a page we go to the right frame/template (where all buttons, textAreas (CSS enabled), dynamicTexts.... ARE BLANK) and after we set all the components according to what we need.

The problem is:

if we call show() (the functions which populate the components) before gotoAndStop() we don't get the components set. Ok, so we call gotoAndStop() then show() but some components are not rendered, mainly the "heavy weight" ones, like big textAreas with lots of CSS formated content inside. We put a delay (150 ms) between gotoAndStop() and show() and this way all the components are rendered correctly but you can see the components moving in the screen... it's awful!

So we get the advice from a forum and now it looks better. But because the timer (for an old problem) you can see the pages "flashing" it's weird!

So, is there any way to populate the FRAME before going to it? Or maybe any other approach to achieve a good result on that?

P.S.:We have been looking for an answer for a long time and so far we didn't get an answer in other forums!

Cheers!

[F8] Dynamically Setting Text Colors
i have 4 different text format styles i will apply to different text fields. My dilemma is that i can not get Flash to accept something like

Code:
txColorCounter++;
txField.setNewTextFormat(ts+txColorCounter)


any ideas how i can get a dynamic counter to add the numeric suffex to the "ts" of the textFormat object?

thanks



Code:
//*******set WHITE text styles**********
var ts0:TextFormat = new TextFormat();
ts0.font = "Century Gothic";
ts0.size = 10;
ts0.color = 0xFFFFFF;
//*******set ORANGE text styles**********
var ts1:TextFormat = new TextFormat();
ts1.font = "Century Gothic";
ts1.size = 10;
ts1.color = 0xFFCC33;
//*******set Pink text styles**********
var ts2:TextFormat = new TextFormat();
ts2.font = "Century Gothic";
ts2.size = 10;
ts2.color = 0xff99CC;

[F8] Dynamically Setting The Functionality Of A Butotn
I have an mc and within it is a button. It's a dialogue mc that I fill text by calling a function and changing the variable of the text box. However sometimes I want the same button within the mc to do different things at different times, and I was wondering if there was a way to dynamically set the function of the button without having to create a separate frame for each instance. I tried just calling:

Code:
_root.mc.okBtn.onRelease = function() { trace("test"); }
before and after I display the mc, but it didn't do anything.

Setting A Movieclip Colour Dynamically
Howdy,

Nice looking forum.

I am having problems changing the colour of a movieclip dynamically, from an XML file.

I would appreciate it if someone could please point me in the right direction.

Many thanks,

Cheers,
John

Setting Static Variables Dynamically
I have an application that instantiates a class several times. Many variables for the class are loaded from an XML at runtime and can differ with each run of the program, but will not change once the program is running.

I would like to initialize the static variables in this class once and then rely on their values throught the program. I might do this in the constructor function but then I suspect I am doing it each time I instantiate the class and therefore will suffer excess overhead.

1. Is there a way to set the static variables once and then let it go without a check in the constructor each time to see if they are a null value (and thus set them)?

2. Must I create an instance of the class to set them?

All help appreciated.

bob

Dynamically Setting Registration Point
hey everyone,

how can i load a jpeg into a dynamically created movie clip and have the registration point be in the center of the enclosing movieclip?


all the best,

miledugo

Dynamically Setting Function Type Through Xml
I have a number of functions and I want to execute 1 based on the entries in a .xml file

part my xml file reads as follows

<funcType>thisFunc</funcType>

In my .fla I have defined thisFunc along with a number of similar functions

I want to execute the function as follows

chosenFunc=Node.childNodes[0].childNodes[0].nodeValue;//points to thisFunc in the .xml file

chosenFunc(); // This should execute as thisFunc ()

Problem is this doesn't seem to be working. Am I trying the impossible?

Dynamically Setting Tint Of Objects
Anyone know how to set the tint property of objects dynamically? Similar to how you can set the alpha property with actionscript. I'm sure this is simple I just can't seem to find the answer. Any help is really appreciated. Thanks.

Carey

Setting Registration Point Dynamically
Hi peeps,

I was wondering if setting the registration point for display objects was possible during run-time. The documentation calls it "..the origin (0, 0 coordinate) of its coordinate space " but other than setting it in the IDE when creating library items I wouldn't know what property to set (or method to call) .

Also noticed something funny...if you assign a value type other than string(sounds logical at first) to a textField.text property the compiler throws an error. Like :

var nNumber:Number = 0;
var tTextField:TextField = new TextField();
//addChild(tTextField);
//setChildIndex(tTextField, numChildren -1);

tTextField.text = nNumber; // This throws error
"1067: Implicit coercion of a value of type Number to an unrelated type String."

tTextField.text = "" + nNumber;
tTextField.text = nNumber + "";
tTextField.text = nNumber.toString(); //These compile just fine

So adding an empty string before or after will compile. It must be I'm missing something or... I just smoke too much these days. I may be high right now...

Setting OnPress Function Dynamically?
Hello! I have a problem. I make some movieclips dynamically but i can't make the onPress function to work?

Any ideas whats wrong ...

loader_xml.onLoad = function(s){
var antal = loader_xml.firstChild.childNodes.length;
for(i=0;i<antal;i++){
photoslider_mc.createEmptyMovieClip("bild"+i,i+100);
photoslider_mc["bild" + i]._x = i * 200;
photoslider_mc["bild" + i].onPress = function(){
changeImage(loader_xml.firstChild.childNodes[i].attributes.largeimage);
}
loadMovie(loader_xml.firstChild.childNodes[i].firstChild.nodeValue, "photoslider_mc.bild" + i);
}
}

Dynamically Setting Properties Of A MC Instance. (using A Loop)
Hi I ran into a problem you might be able to solve.

In my application a number of similar MC’s will appear each time the user will press a button. the MC’s will appear randomly in different locations. Assuming there are 5 MC’s (movie1,movie2...) I would like to run a loop so each movie instance name will get one of 5 optional values:

-------------------------------------------------------------------
B=0
while(b<4){
pos=random(100)
eval("movie"+b+"._x = pos")
eval("movie"+b+"._y = pos")
b=b+1
}
-------------------------------------------------------------------

this script does not work, I understand that it might be because you can only read variables using 'eval' but not write them. however according to the Macromedia Flash MX help :
"You can also use the eval function to dynamically set and retrieve the value of a variable or instance name..."

how can I solve this and assign the X,Y property to each instance of an MC using a loop ?

Thanks.

Dynamically Setting Instance Names For Attatched Mc's ?
is there a tutorial that covers this, or a basic feature of flash that i am missing that keeps action script in an attatched movie from running..

ie: i have a movie clip on the stage. it's job when clicked and dragged is to attatch an instance of itself to another mc.

this works.

however, trying to click and drag the attatched mc its as if no script is there at all.

am i missing something.. i am wondering if perhaps the instance name conflict thing is happening.. IF SO..

is there a way to get the instance name of an instance dynamically for use in actionscript?? var instance_name = this.instance_name ??


thanks

Dynamically Setting Number Of Form Fields
I’m trying to make an entry form on a web page that the number of lines can be set by the user. What it’s going to be is basic book information broken into separate fields for title, author, etc. with a new line for each book. The results will then be e-mailed to me using php or cgi script.

The problem I’m having is one person might enter just one book, and another might have 20, with each entry is going on a separate line. The problem is making a form that generates the correct number of lines with all the necessary fields. My first, and only thought was having a small text entry box at the top where the user types in the number of books they want to enter, then click a button. Then the form would generate the correct number of lines needed. I know that I could just set up a simple multi line text entry box, but I want to control the entry of all the information.
I don’t know if I just need another cup of coffee, or three, but nothing seems to be working. Any ideas?

Dynamically Setting Text And Resizing Canvas
Hi

setting text

I'm made a button in which I put a dynamic text box, and gave it the instance name "caption". I removed it from the canvas, since it gets added using the attachMovie method. The caption comes from the html in the form of <PARAM NAME=movie VALUE="mymovie.swf?btn1=Click+Here">

I know that this parameter is loading, so that's no problem.

The problem is, that this value does not get loaded into the textbox.

I attach the button in the root:

Code:
attachMovie("btnTemp_exp", "button" + x, x);
with (_root["button" + x]) {
_x = 1;
_y = (_root["button" + x]._height * i) + 1;
_caption.text = eval("btn" + x);
}


I checked, and eval("btn" + x) returns the value of the passed parameter. the buttons get attached. When I do this:

Code:
trace(_root["button" + x]);

the result is:

_level0.button1

but when I do this:

Code:
trace(_root["button" + x].caption);
// caption is the instance of the textbox

the result is:

undefined

what am I doing wrong?

resizing canvas

I'm also trying to resize the canvas using actionscript. my button's height is 20. I want to specify in the params how many buttons I have, and pass their captions as well. if I have 3 buttons, the canvas's height should be 60. If I have 5 buttons, it should be 100. I managed to do this using actionscript, but the buttons stretch with the canvas. this means that if my original canvas's height was 20, and I want 3 buttons, it will now, be 60, but the button's height is also 60. I've seen flash movies that appear to be doing the same thing. Am I dillusional, or is there a way to do this?

Thanx in advance

Setting Links Dynamically From A Text File
I have included a .fla that I need help with. In the movie clip "Final Button" I have a layer called "button". There is also a layer called "linkGetter". When I run the .swf "linkGetter" loads a text url from a text file. What I want to happen is that when the button in the "button" layer is pressed that it goes to the URL in "linkGetter". I cant seem to get this so some help would be appreciated and for all you experts out there I would think that this would only take a second. Thanks! PS... my Action Script for loading the variables from the text file can be found in the "actions" layer of the main timeline if that helps at all. Thanks!

Setting Dynamically Postion Of Playhead Of Sound
Hi All,

I am going mad with the simplest problem. At this time mind is fully washed out. I want to play my sound from the value I received in songSkiped. Here soundFactory is an object of Sound Class. Help me......


PHP Code:



var songSkiped:Number=(progress_mc.slider.x/progress_mc.width)*soundFactory.length;

Dynamically Setting Font Size = Locked At 127 ?
I'm trying to set the size of some textfield in my movie dynamically during the running of the movie.

When i try and change the font size of these textfields BEFORE compilation, i can get sizes of up to 500 or more ...

When i try doing this AFTER compilation, textFormat and the likes, it seems Flash stops enlarging when it reaches a font size of 127.
I can't seem to find anything on a possible lock of this value ...

Any ideas ??

Setting Compression On Dynamically Loaded Png Files...
I love how I can import a lossless png image with alpha into Flash, AND apply jpg compression to it to make the file size smaller while retaining the images transparency. I have always just did this manually by importing the png, and selecting a good compression level. Now I want to add png files dynamically. is there a way to compress the files after dynamic loading? Or maybe there is a way to compress a png file in photoshop? Thanks for any help!

if it comes down to it, I'll have to put each image I want to load in its own external swf and set the compression there, but I would like to avoid this extra step.

Setting The Width Of Dynamically Loaded Images
In a project im working on i get the following strange behaviour:
I load an image with a loader object
listen for the contentLoaderInfo Event.COMPLETE
and then set the width of the target.content
problem is that the width of the loaded image is not set.

can the COMPLETE event fire before the image is completed or what could be the problem?

here's the code:

var shopImageLoader:Loader=new Loader();
shop.shopItem.addChild(shopImageLoader);

shopImageLoader.load(new URLRequest("cover_url")));
shopImageLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, onShopImageComplete);

function onShopImageComplete(evt:Event):void{
evt.target.content.width=68;
evt.target.content.height=68;
}

Setting Properties Of Dynamically Loading JPEGs
I have a basic movie which dynamically loads JPEGs into a main movie file. I will update the JPEGs via FTP so this all works good for my client. However, I need to set a different location for the loaded JPEGs. They load into the upper left, top corner of the main movie. I need to somehow (setPropery?) set the _x and _y location that the JPEGs load into. I can not and do not wish to load via a button. I am not loading a library item or a swf file either, therefore setting the properties of an instance seems to be out as well. Preview what I am dealing with at: http;//www.ezzona.com/weiss/test.html

Any help is appreciated.

Jim

Dynamically Setting Tint Property Of Objects
Anyone know how to set the tint property of objects dynamically? Similar to how you can set the alpha property with actionscript. I'm sure this is simple I just can't seem to find the answer. Any help is really appreciated. Thanks.

Carey

Dynamically Setting Linkage/runtime Shared URL?
Just curious if there's a way to dynamically set the value of the runtime sharing URL field inside a symbol's properties? We're using extensively the import/export for runtime sharing capabilities for a project but are having problems with Netscape not recognizing just a simple filename without the full URL in that field........

Thanks!
nd

Copyright © 2005-08 www.BigResource.com, All rights reserved