Easy Syntax Question
hi all I'm new to flash and AS and have a quick syntax question for you :)
this works:
Code: trace(_root.tiles.t_5_5_dot._x) but not this:
Code: var tmp:String="t_5_5_dot"; trace(_root.tiles.tmp._x) how do I refer to tmp as an object name?
sorry to bother u with such a noob question ;) thanks
ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 11-26-2006, 04:07 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
ONE EASY WITH SYNTAX ;;;;;;
speed = 1;
if (Key.isDown(Key.BACKSPACE ) and Number(t-ot)<300) {
speed++}
the question is....when I make some variables and want to assign some values when do I write them with the ; in the end end when i sholudn't??
if i was gona write ......{speed++; ot=5; and maybe some other variables}
did i put it ok or not correct me please and explain how it goes
Syntax Problem, Easy One
I'm trying to do something like this: the movie clip "locator + i" has to gotoAndStop in the frame named / labeled " LocatorVarOne " NOTE :: LocatorVarOne is a variable, that contain a letter such as "a", "b", "c", etc...
Code:
_root.navigation.main.map.this["locator"+i].gotoAndStop(LocatorVarOne);
EASY Syntax Help Needed I'M STUCK
Hi all,
Can anyone help with the following . I'm stuck! The following line picks out an MC on the root level by using a variable - "whichpic" (which changes according to a button event), and tells that MC to go to and stop at frame "visited_on". Easy!
_root['indicator'+whichpic].gotoAndStop("visited_on");
My problem is that I want to move the MC's off the main timeline. So in effect I want to be able to do this:
this.['indicator'+whichpic].gotoAndStop("visited_on");
or
parent.['indicator'+whichpic].gotoAndStop("visited_on");
But it does not work. What syntax can I use to correct this?
Thanks a lot. I'd really appreciate anyone's help!
Jimarse.
Easy ActionScript Syntax Question
I am very new to ActionScripting, and am attempting to create a menu with buttons that overlap, when the user scrolls over the button, the button needs to become fully visible, when the user moves the mouse out, it returns to previous state, i know that i should be using swapdepth, but i can't seem to figure out the syntax:
Currently two button instances exist
over and under, over is currently the button that is dominant.
Here's what i have set for the action pannel of the button named under:
on (rollOver)
{
_root.swapDepths(_root._over);
}
on (rollOut)
{
_root.swapDepths(_root._over);
}
The syntax example that macromedia flash offers is:
myMovieClip.swapDepths(target)
target The movie clip instance whose depth is swapped by the instance specified in myMovieClip. Both instances must have the same parent movie clip.
the things that confuse me are
1. how to reference the target, i thought i could just say _over, but that didn't work, I guess this has something to do with objects and object ownerships, so i tried _root, didn't work either, i've tried a lot of things
2. what value myMovieClip represents, how do i find out what that value is, is it the name of the file?
But like i said, I'm new to this, and it's greek to me, i used to be a programer about 10 years ago, but my career changed tracks, i want to get back in, but i'm way too rusty. Your help is greatly appreciated
in case any one wants to look at my fla i'm attaching it
SUPER EASY / RETARDED EASY SetMask ?
Ok got a simple retarded question. I have 1 swf loading into a holder_mc and a mask_mc set with setMask but it is not working. There is nothing else to this but so help me it is not working and I know I have to be overlooking something simple but I am just not seeing it.
Heres the whopping 3 lines of code:
code: stop();
contentHolder_mc.loadMovie("home.swf");
contentHolder_mc.setMask(contentMask_mc);
Example attached.
thx
c
Actins:wrong Syntax=correct, Right Syntax=wrong
Has any body made a similar observation:
when I want to load a pic into mc and write
_root.loadMovie("pic.jpg","mc");
I get a little window just the size of my pic but not my stage. But when I write:
_root.mc.loadMovie("pic.jpg");
everything is fine. I have a Mac, OS9.1. Is this related to the flashplayer in mac or what?
Easy Question, Hopefully Easy Answer...
How can i create a grid of 20 movieclips? I would like to have 4 columns and 5 rows.
Its going to be used for a drag and drop game. any help would be REALLY appreciated!!
Easy Question Or Not So Easy?
I am trying to save buttons and movies I have created to the main Library for use in other projects and I am having trouble figuring out how to do this. I am using flash mx. I tried going into program files and flashmx and finding the library that way. I thought I found the folder and exported a file to it and when I opened the folder it was there but when I was in flash and opened the main library flash provides for you it did not show up. Please help this newb.
thanks,
Don
Easy Easy Question
alright i have a movie clip within my movie that will display text, but the text is always different and it loads it dynamically what is the best way for each of my buttons to tell the movie clip to load and then tell the textbox to load a specific file.
_alpha / Easy In And Easy Out
I need for this code a Easy in/ onRollOver and Easy out/ onRollOut.
---
for(i=1;i<6;i++){
theButton=_root["mc"+i];
theButton.thisNum = i ;
theButton._alpha = 0;
theButton.speed = 5
theButton.onEnterFrame=function() {
if (_root["mc"+this.thisNum].overMe) {
this.elasticScale(150, 0.7, 0.3)
} else {
this.elasticScale(100, 0.7, 0.3)
}
}
theButton.onRollOver=function(){
this.speed = 5;
if (this._alpha > 100)
{
this._alpha += speed;
}
else
{
this._alpha = 100;
}
_root["mc"+this.thisNum].overMe=true;
_root["mc"+this.thisNum].swapDepths(5000)
}
theButton.onRollOut=function(){
this.speed = 5;
if (this._alpha > 100)
{
this._alpha -= speed;
}
else
{
this._alpha = 0;
}
_root["mc"+this.thisNum].overMe=false;
_root["mc"+this.thisNum].swapDepths(5000)
}
}
Syntax? Why Cant I Do This Way?
Please take a look at the code below. Could someone please explain to me why I cant call a instance by its name until it has played (or that seems to be the case). Basically I cant use the statement: "_root.Intro.gotoAndPlay(1);" in the "else" statement it only allow me to identify it as "_root.gotoAndPlay(2);". Why wont the actionscript allow me to call it as an instance name? It works fine in the "if" portion of the statement...I assume because it has already begun playing. Please clarify this for me.
on (release) {
if (_root.Intro._framesloaded > 0) {
stopAllSounds ();
_root.Stop();
_root.Intro.gotoAndPlay(1);
} else {
_root.gotoAndPlay(2);
}
}
Thanks for your help
Sean
Syntax Help
I have 30 webpages named 1.htm, 2.htm etc.
I'm trying to select one at random and open in a specific frame
Can I use random to construct the URL and getURL to open ?
And if so HOW ?
I'm sure I'm doing something wrong with all the Expression checkboxes but can't work out if there's something deeper wrong in my logic.
Dot Syntax
I have a for loop in which I want to do a tell target..since it's depreciated I thought I try dot syntax.
But I can't figure it out...what I want is this:
_root."char" add i.gotoAndPlay(14)
but that doesn't work
again please help...
Thanks
Dot Syntax
where can i find an in-depth walkthrough of flash 5's dot syntax? i have no experience with javascript, and i'm still using the slashes to target levels and movieclips. sigh... please help!
Dot Syntax
can someone convert this to flash 5 syntax (not that this won't work in 5
height = getProperty ("../../body_text/" add ../../body_text:scrollTarget add "/scrolling", _height );
thanks
Need Some Help With My Syntax
Here's the question:
If I have a variable x getting a random number
ie. x = Math.random()
How do I get the value of x to show up in a loadMovie URL?
ie. mymovie.swf?x
(I want x to be the random number, instead of it interpreting it as the actual letter x)
Any suggetions would greatly appreciated. Thanx.
Bad Syntax?
I know I'm just writing this wrong. I know this because I always write actions with variables wrong. How do I write:
'_root.darts.whole_game.buggy.bug_run_' + Number( _root.darts.whole_game.whichbug) + '.stop()'
I just want to send a Stop acticton to a movie clip using the variable "whichbug"
Thanks
Frequent-C
Bad Syntax
Why does this work
_root.Explode_1.duplicateMovieClip ("Explode_2", 1);
but this doesnt
"_root.Explode_" + _root.CurrentBall + ".duplicateMovieClip ("Explode_2", 1);"
Right Syntax?
how to attach several for example _levels 1-10:
for (...)
level[+n] ...
whats the right syntax for _level+variable
Need Some Syntax Help... I Think...
ok, in this example:
getURL("javascript:functionName(variable1,variable 2,cariable3)");
I want to use a dynamic variable for "functionName" so I can change the function I am calling at runtime.
so i would assume it would look something like:
getURL("javascript:"_root.variableName"(variable1, variable2,variable3)");
but that does not work... and this is most likely a result of my not understanding JS as well as I should.,.. but could anyone shed some light ont his for me?
Raiven...
thx in advance
Help With Dot Syntax
What am I doing wrong?
//This is how you would do it without the dot syntax
for(i=1; i<=10; i++) {
target = "target" + i;
tellTarget (target) {
gotoAndPlay(2);
}
}
//This doesnt't work because there is no movie named "target", only ones named "target1","target2"...
for(i=1; i<=10; i++) {
target = "target" + i;
target.gotoAndPlay(1);
}
//This is what I'm trying do do, but I can't get it to work in the for loop
target1.gotoAndPlay(1);
target2.gotoAndPlay(1);
target3.gotoAndPlay(1);
target4.gotoAndPlay(1);
target5.gotoAndPlay(1);
target6.gotoAndPlay(1);
target7.gotoAndPlay(1);
target8.gotoAndPlay(1);
target9.gotoAndPlay(1);
target10.gotoAndPlay(1);
Please help me, Thanks
Syntax
I need some help putting a loop together.
1 function coinHit() {
2 i = 1;
3 while (i<=3) {
4 if (_root.coin+i.hitTest(_root.ball)) {
5 _root.coin+i.play();
6 }
7 i++;
8 }
9 }
I have tried every combination I can think of, to get this to work.
I have three coins. (coin1, coin2 and coin3) I want to run a hitTest on each of those three coins, by calling this single function. However, I don't know how to write lines 4 and 5 correctly.
Can anyone help?
Also, where can I find this out in future? Does anyone know whwre I can look up concatenation like this? I always get stuck on this. A mental block /
Thanks.
Dot Syntax
hi | i'm building a shell for a movie and i'm having one problem. on the main timeline i have a movie with a button. on release, that button sets a variable on the main timeline and it also jumps back to the main timeline and has the playhead go to frame 3, i.e.
on(release) {
myVariable=1;
_root.gotoAndPlay(3);
}
-- this part is working fine --
on frame 3 of the main timeline is another movie which has a condition:
if(_root.myVariable=1 {
placeholder.loadMovie("one.swf");
}
the problem is that the placeholder movie clip (which has the instance name of placeholder) isn't loading the external movie -- which is targeted correctly. i also ran a trace statement in this second movie just to make sure that _root.myVariable=1; -- and it did. does anyone have any ideas why my placeholder isn't responding to the command?
thanks, - matt.
Syntax?
Is their an on line source for flash like the java doc are for java? To help explain all the syntax?
Thanks
JOptionPane
Syntax Help
Ok,
I'm trying to preload a external swf but i cant seem to get it to preload right. Can anyone help me out with the correct syntax?
Dot Syntax Help
I made a slideshow that fades in and out. With a link back to the root time line in the last frame like so _root.nextFrame(); then it would go to the next frame in the root time line and start the next movie and it all worked well. Then I made it in to a movie called slideshow with an instance name of sh can anyone tell me what the path would be to make it work again? What I basically have is a movie inside a movie and I want it to go to the next frame on the root time line of the outside movie. Hope this makes sense.
Thanks
JOptionPane
Another Old Syntax
hi,
what is this in mx actionscript n
its the ":" that paticularly confuses me
Code:
ny = eval("../" add n add ":ymov");
thanks
mark
Syntax Help?
Could anyone tell me the syntax for 'on click' tell a movie clip to go to frame 2 (of itself) and play. (ie: so a button is clicked and another movie clips plays from frame 2)
it used to be telltarget didn't it?
thanks
IF Syntax
I want to use the IF statement to determine whether or not a movie should play and would like to know how to lay it out.
These are the factors:
If the movie is at frame 6 then play the movie
but if is at any other frame then dont play.
This will be activated by clicking on a button.
Thanks - Joe
Syntax
Could anyone give me the correct syntax here.
If you are finding the x position of an object using it's library identifier you use this
for (x=0;x<100;x++)
x=_root["identifier"+i]._x
What is it if you are using it's instance name?
x=_root.identifier[i]._x
would this be it???
Thanks
What Does The Syntax 'in' Mean?
I have a sample .fla I got from FK that I am learning how to build an mp3 from. one of the functions is this.
code:
function select(){
for(i in playlist_mc.target_mc){
if(playlist_mc.target_mc[i].songNum != songNum){
playlist_mc.target_mc[i].gotoAndStop(1);
}
else{
playlist_mc.target_mc[i].gotoAndStop(2);
}
}
}
What does the 'in' mean in the line
for(i in playlist_mc.target_mc){
There is no listing for this in Flash's reference.
Syntax Help
Is this syntax correct? I'm not sure how to interpolate the i variable in this for loop:
Code:
for (i=1; i <= 3; i++) {
pic[i]_mc._alpha = 0;
}
What I'm trying to get is simply:
pic1_mc._alpha = 0;
pic2_mc._alpha = 0;
pic3_mc._alpha = 0;
Syntax
Hi
what is the syntax to specify something like this
idClients = new array("Party22","Fox22","Elite");
//load the names from the array (as dynamic text)
for(i=0;i<11;i++)
{
idText+i.text = idClients[i]; //this bit here
}
how do u write idText+i.text so it works as if idText+i is one variable ??? It should be something with [] but I can't remember. Also is there a way to maybe load these names from single external file insted of array and how would I specify as many variables as needed in one file so when u pull it in each text field pulls right variable contents. i know how to have a txt file with single variable but not multiple variables.
Cheers
What's The Syntax?
Hi all, I have a movie with an empty MC called "container" in which I need to attach "pages" from the library. on each page I'll have 2 buttons, next and previous. Also on the first frame of each page I have this:
_root.currentpage = 1; (or 2, 3, 4 etc)
The pages are linked as page1, page2, page3 etc.
What I want to do is have the "next" button attach the next page by it's number and then go to a frame label on that page. I don't know the proper syntax but here's what I've got:
on (release) {
container.attachMovie("page" + (_root.currentpage + 1) ,"page" +(_root.currentpage + 1),1);
container.page+(_root.currentpage).gotoAndStop("pa ge");
}
Can anyone help me out?
Syntax For 'using'
I recently saw in the middle of a thread a cunning way of putting 'using' then I think, a path, and then a whole load of variables so you didn't have to rewrite the path the whole time.
Would be really useful if someone could let me know what the syntax was.
Thanks.
XML Syntax
Hi, I get an error when trying to view the following xml.
<coworker1 imageURL="Einstein.jpg" linkURL="http://iwww.org.distr.com/news_detail.asp?news_id=88183"></coworker1>
The '=' sign is not accepted. Anyone now how to rewrite the XML to get it to work.
Thanks!
/october
Syntax
I'm sure this is easy but i don't know why this isn't working. The path is correct but it keep giving me this error. It is written on an MC.
onClipEvent (enterFrame)
_root.cater.cattext._visible = false;
BUG REPORT
Scene=catering, Layer=cater, Frame=1: Line 2: '{' expected
_root.cater.cattext._visible = false;
Syntax
hi
what is the syntax to get dot+i to work ?
dot is the name of a movie clip ??? undefined at the moment?
for(i=1;i<96;i++)
{
cordX[i] = getProperty((dot+i), _x);
cheers
For.in Syntax Help.
Brain is not working properly today.
Why isnt this code working? I need to continue coding yet Iam totally stumped why this isnt working. What Iam I not seeing here ?
Quote:
onClipEvent (load) {
for (c = 1; c <= 5; c++) {
_root.mc_bm.mc0[c]._visible = 0
//_root.mc_bm.mc01._visible = 0
}
}
Quote:
onClipEvent (load) {
for (c = 1; c <= 5; c++) {
Trace( "mc0"+[c]+"._visible = 0" )
Eval(mc0[c]._visible = 0)
//mc04._visible = 0
}
}
Syntax Help
code:
this.["MC"+b].["holder"+b].loadMovie("totalmovie"+b+".swf");
this.["MC"+b]["holder"+b].loadMovie("totalmovie"+b+".swf");
this.["MC"+b+".holder"+b].loadMovie("totalmovie"+b+".swf");
Flash doesnt like any of these....
What is correct here
Syntax
hi.. i came across this fla file..
and it has this line of code in it.
/:target_bg = _level0.target_bg0;
what does "/:" mean?
and how do i find "_level0.target_bg0" in the movie without going through the entire libray list.. i tried using the movie explorer.. but i cant find "target_bg0".
any help guys?
Syntax Help.....?
Hi guys.
I have the following code, where rana,ranb,ranc and rand are all numbers. boolVal is either > or <.
Code:
if ((rana/ranb)+boolVal+(ranc/rand))
{
//do something
}
else
{
//do something else
}
The trouble is it doesn't work!! I'm sure there's a way of passing a var (boolVal) into an if statement like this, but my syntax is incorrect.
Can someone please tell me how it's done?
Syntax Help Please
I currently have
scroll_btn.onDragOut = function () {
delete this.onEnterFrame;
}
scroll_btn.onRelease = function () {
delete this.onEnterFrame;
}
I am sure they can be combined into one function but can't get the syntax to work.
Something like
scroll_btn.onRelease, onDragout = function () {
delete this.onEnterFrame;
}
Any ideas?
Help With Syntax
Hey
here is an easy one for you scripting gurus. I am loading images from a folder into an empty Movieclip.
So i have this:
this.createEmptyMovieClip("image",1);
image.loadMovie("images/fashion/f1.jpg");
what i want to do is have a variable called imageNum reference the image number i am currently calling too. Basically i just need to know the syntax for something like this:
image.loadMovie("images/fashion/f+imageNum+.jpg");
i can't seem to figure out how to place imageNum into the name of the image i want to load...hope that makes sense
any help would be much appreciated
Syntax Help
Hi Gang
Anyone see whats wrong with this?
function attach_template (path, templatename, stagename, depth, x, y) {
myLevel[path].attachMovie(templatename, [stagename], depth);
myLevel[path][stagename]._x = x;
myLevel[path][stagename]._y = y;
myLevel.nextY += myLevel[path][stagename]._height;
}
with myLevel referring to the _root
Thanks
Phil
Syntax Help
Hi, i am new to actionscript and am going through other peoples code trying to understand. Perhaps someone can help me understand this syntax.
if (viewer._alpha > 10 && fadeOut) --> I know this means if viewer._alpha is less than 10 then.... BUT what does the && mean to the fadeout?
if (viewer._alpha < 100 && fadeIn && !fadeOut) --> what does the ! sign in front of foundout do? And what is this essentially saying?
It is probably simple, but if I want to eventually start writing my own stuff then I need to know what it means and does.
Does anyone know anygood sites to teach this stuff?
Simon
|