Simple Syntax Issue
There seems to be a bit of a gap in my knowledge of AS syntax... In many of my projects in the past I've used code like this: code: ["mc"+var]_x = 0; to access a complexly named mc's fields. I had never tried to do the same for calling a method of such a movieclip, ie: code: this.["mc"+var]doSomethingAwesome(); When I did try this however, Flash spits out "Expected a field name after '.' operator." Does anyone know how to do this?
FlashKit > Flash Help > Flash ActionScript
Posted on: 04-29-2007, 10:34 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Simple Syntax Issue
I have for gotton the correct syntax for this. I am inside an MC and at the end want it to tell the main timeline to proceed to the next frame. Since there are different scenes, the one I am refering to is 'main'. I have tried:
_root ("main").gotoAndStop(2);
_root.main.gotoAndStop(1);
gotoAndStop ("main", 2);
None of these seem to work....
Can anyone help me?
A Simple Syntax Issue...
Ok, in the main timeline, i declare my variable:
movie = variable;
I have a series of buttons on the screen. Each one calls a different MC (e.g., instance 'ebusiness') and also assigns the value of that MC to the variable:
on (press) {
_root.ebusiness.play();
_root.movie = _root.ebusiness;
}
The MC plays normally. I have a general button outside on the main timline which closes whatever MC is open at the time, but this part does not seem to work too well:
on (press) {
_root.movie.play();
}
The 'play' is suppoed to get the MC to continue from it's internal 'Stop' command and it closes itself.
What am I doing wrong?
Simple Syntax Issue I Think....
making a basic coloring book,
the paint brush is coloring just fine, but the target areas are not.
any help on how to write this?
code:
startDrag(_root.paintbrush, true);
_global.chosencolor = 0x000000
myColor = new Color(_root.paintbrush.paintbrushColor);
_root.black.onRelease = function() {
myColor.setRGB(0x000000);
chosencolor = 0x000000
};
_root.blue.onRelease = function() {
myColor.setRGB(0x3300ff);
chosencolor = 0x3300ff
};
_root.green.onRelease = function() {
myColor.setRGB(0x33ff00);
chosencolor = 0x33ff00
};
_root.red.onRelease = function() {
myColor.setRGB(0xcc3300);
chosencolor = 0xcc3300
};
_root.area1.onRelease = function() {
area1.setRGB(chosencolor);
};
_root.area2.onRelease = function() {
area2.setRGB(chosencolor);
trace(chosencolor)
};
Simple Syntax Issue?
Hi,
I just want a function to return true, but after a LoadVars.onLoad
event.
Am I right in assuuming that the return in the onLoad = function below
relates ONLY to that function?
What I want is for the sendLockCheck()
to return true depending on the if statement within the onLoad.
function sendLockCheck() {
var lockCheckResult_lv:LoadVars = new LoadVars();
var lockCheckSend_lv:LoadVars = new LoadVars();
var lockCheckArray:Array = new Array();
lockCheckResult_lv.onLoad = function(success:Boolean) {
_root.loko = lockCheckResult_lv.loko;
if (lockCheckResult_lv.loko != "syn") {
return (true);
}
};
lockCheckSend_lv.sendAndLoad("check.php", lockCheckResult_lv, "POST");
}
Any help appreciated.
Thanks
Andrew
Complex Audio Issue..or Maybe Just Syntax Issue
what's up peoples. I'm building a new site for my studio and having some audio issues i can't explain very well, so here goes:
I've got an external .swf successfully loading into _level6 of my project with it's own audio. and from reading thse forums, i know that if i want to control the audio independently of other audio, i need to attach the sound object to a seperate movieclip, which i'm doing and I can control the audio just fine. However, when i click to load in a dynamic image into a dynamicly loaded movieClip, the volume button no longer works. Both the soundobject's mc and the dynamic mc's are being loaded into the nextHighestDepth() so i don't think one is kicking out the other. Here's what i've got:
Code to attach the soundObject when the section starts:
Code:
this.createEmptyMovieClip("soundstage6",this.getNextHighestDepth());
work_sound = new Sound(soundstage6);
work_sound.attachSound("myaudiofile");
work_sound.start(0, 999);
Code to control the volume:
Code:
this.testVol.onPress = function () {
this._parent.work_sound.setVolume(0);
}
Code that loads in my dynamic images:
Code:
this.testLoad.onPress = function () {
_root.attachMovie("infoClip", "infoClip", this.getNextHighestDepth(), {_alpha:0, _x:491.1, _y:193.9});
}
that testLoad button does severl other things when clicked, but when i comment out that particular line of code, the volume control button contines to work. I'm sure this has something to do with the fact that all of this is occuring on _level6 but i have no idea why or how to fix it!!!
Anybody have any ideas? Sorry for the long and complex explination!!
Syntax Issue?
I have txt file hat I am loading into flash using the LoadVars property. No problem there. The content of the txt file is simply
Code:
email0=www.mywebsite.com
in my movie clip ContactInfo, I have a dynamic text box w/instance name "email" and my code looks like this, but it doesn't show up when I test the movie.
ActionScript Code:
ContactInfo.email.html = true;
ContactInfo.email.htmlText = "<a href ='mailto:"+this["email"+0]+"'><font face='Garamond' size='15' color='#000000'><u>"+this["email"+0]+"</u></font></a>";
If I do a trace this.email0, the output window displays the correct response. What am I doing wrong? I made sure the characters are set for dynamic text, and verified that the txt file is getting loaded. I even tried replacing
this["email"+0] with this.email0. But I got the same results.
Little Syntax Issue
ok I can't seem to straight my head in this one. it is a basic attaching and placing the mcs on the stage by getting data from the xml. I am getting the data with no errors and when I trace my mcs all are there, and when I trace their _x position all seem ok too, still I can only one instance on the stage. if I change _x to _y in the line I'll mention I can see all the instances.. I am really burned out here.
you can try this by putting a mc that's 114 width and a textbox name tit giving it a export name of image..
Thanks in advance.
ilteris
ActionScript Code:
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(status) {
if (status) {
tempxml = myXML.firstChild.childNodes;
maxEntries = tempxml.length;
_root.slide("container", "image", 1, 1, 50, maxEntries, 114, 1, 1, 100);
}
};
function slide(obj, clip, depth, target, speed, maxImages, imgWidth, ImgNr, distance, posY) {
this.createEmptyMovieClip(obj, depth);
for (var i = 1; i<=maxImages; i++) {
this[obj].attachMovie(clip, clip+i, i);
//trace(this[obj][clip+i]);
this[obj][clip+i]._x= imgWidth*i
//<<<<<<<<<<<<<<<<<<<<<<<< If I can change _x to _y I can see everything
trace(this[obj][clip+i] + "="+ this[obj][clip+i]._x);
//this[obj][clip+i]._y = posY;
this[obj][clip + i].image = i;
this[obj][clip+i].tit.text = tempxml[i-1].attributes.tit;
this[obj][clip+i].onRelease = function() {
imgNr = this.image;
trace(this.image);
};
this[obj].onEnterFrame = function() {
this.xdiff = this[clip+imgNr]._x-target;
if (this.xdiff != 0) {
this.xdiff = Math.round(this.xdiff)/Math.round(speed);
for (var i = i; i<=maxImages; i++) {
this[clip+i]._x = this.xdiff;
if (this[clip+i]._x<=(target-imgWidth)) {
this[clip+i]._x += maxImages*imgWidth
}
}
}
};
}
}
myXML.load("titles.xml");
So Close - Syntax Issue
im trying to load a jpeg named thumba1.jpg
onClipEvent (load) {
initial = "a";
thenumber = 1;
thumbnail = initial + thenumber;
thumbimage = "thumb" + thumbnail;
loadMovie("images"+[thumbimage]+ ".jpg", _root.four.galleries[thumbnail].blank)
what am i doing wrong ?
If Get Frame = Then .... Syntax Issue
RE: Flash MX
I need to modify this code,
---------------------------------------
on (release) {
_root.fotos.play(nextFrame());
}
----------------------------------------
It needs to say something like:
----------------------------------------
on (release) {
if get _root.fotos.frame = 99 then goto and play 1
else
_root.fotos.play(nextFrame());
}
--------------------------------------
Whats the correct syntax for this?
thanks
Tal
[f8] Syntax Issue With A Function
Hi all,
I Have a function written out to preload my pages in my flash movie.
However the problem I'm running into is being able to snatch up the bytes_loaded/Total of each of the clips inside my function.
The Function:
Code:
Code:
//Create Function to Handle All Page Preloads
function PreloadPage(Page, Name)
{
trace("Triggered Page Load Function!");
// / Section with problem / //
MCName = _root.LoadedContent_mc.LoadedContent2_mc+Page;
// /Section with problem / //
bytes_loaded_P = Math.round(MCName.getBytesLoaded());
bytes_total_P = Math.round(MCName.getBytesTotal());
get_percent_P = bytes_loaded_P / bytes_total_P;
Rounded_percent_P = Math.round(get_percent_P*100);
_root.Preloader_MC.LoaderTxt = Rounded_percent_P+"%";
_root.Preloader_MC.LoadDescription = "Loading "+ Name +"...";
trace("LoadedBytes: "+bytes_loaded_P);
trace("TotalBytes: "+bytes_total_P);
trace("Percentage Loaded: "+_root.Preloader_MC.LoaderTxt);
if (bytes_loaded_P == bytes_total_P)
{
trace("Fired Load Success "+ Page +"!!");
_root.gotoAndPlay("Content");
}
else
{
_root.Preloader_MC.gotoAndPlay("_PreloadRepeatScene");
}
}
The problem with it is that I can't seem to get my variable "Page" to be stuck into the .(dot) sequence that targets the correct movie clip.
Thanks in advanced for your suggestions,
`eff
C'mon Guys, Help A Girl Out Please - Syntax Issue
Hi,
i'm not a coder and I'm trying to figure out what is likely a simple problem:
I found a piece of code written in flash 4 and I'm updated it to 8 no problem.. ecept for 1 small issue:
Parent clip creates a variable:
set("speedpar" add c, Number(random(15))+5);
Child clip calls it:
x = getProperty("",_x)+Eval("/:speed" add getProperty("",_name));
********************
The parent is no longer the _root, it is 1 level up from the child. how the heck do I reference it using _parent instead of /: ?
Any help would be appreciated!!!!
[MX04] Path And Possible Syntax Issue
Hi,
from the location of my button if I trace
trace(_parent._parent.MadeMe);
I get the answer
Baku_launch.ButtonMc1
Now I wish to set the value of Opened in that ButtonMc1
so I say
_parent._parent._parent[_parent._parent.MadeMe].Opened = 0;
It does not work?
BUT this does if I hard code it
_parent._parent._parent.Baku_launch.ButtonMc1.Open ed = 0;
what is wrong with the path that uses the variable MadeMe?
thanks
mark
Anyone Know The Proper Syntax For This? LoadMovie Issue...
I am trying to get an external swf from the hard drive to load into a container mc. It works all fine and dandy till I send it to someone else PC. Then, bubkiss.
I know it is because of the path, I just can't seem to fix it.
This is my local address to the file:
C: 0 esting.swf
Which I got flash to recognize by using this syntax:
(Although I must admit I don't understand it...)
("file:///C|/00/testing.swf")
So here is the problem, what is the syntax to say in current folder rather then a specific one?
I have tried just using ("file:///testing.swf"), assuming that would mean your current directory, but it is not working...
Simple Syntax Help
I am trying to get variables form a text file to a flash array, this is the code that I am using:
var loginS:Array = new Array();
myData = new LoadVars();
myData.onLoad = function() {
for (i=1; i<50; i++) {
loginS[i] = this.login1; ///I want to change login”1” and use login”i”
trace(loginS);
}
};
myData.load("logins.txt");
The text file looks like this: login1= &login2=&login3= &…………login50= &
What I want to do is on line 5 where it says login1, I want to use the counter “i” so each “i” value of the array gets the corresponding longin”i” form the text file. I am not sure how to format it.
thanx
Simple Get Url Syntax
I have the following code:
ActionScript Code:
bar10.onPress = function() {
this.gotoAndStop("selected");
_global.bar10choice = "select";
getURL("http://www.caillouette.com/cyleconstruction/pastpojects2.html target="_blank"");
But when I click on bar 10 I get the following in my navbar field:
ActionScript Code:
http://www.caillouette.com/cycleconstruction/pastprojects2.html%20target=%22_blank%22
How do I set the target to "_blank" in my getURL command?
thanks
Simple Syntax Question
I have a variable called: sec1 on my main timeline and I need to pass it's value to a sub MC while using a variable in the name
I've tried the following and more I just can't figure it out
sTemp = _root["sec"+section];
sTemp = eval("_root.sec"+section);
sTemp = eval(_root+"sec"+section);
sTemp = eval(_root["sec"+section]);
please help!
Frequent-C
http://www.Freq-Fest.com
Need To Know The Syntax For Simple Problem
how can i check if a movieclip is on a selected frame. for example:
i have a movie clip. its called "frog"
inside the "frog" movie clip i have a frame labelled "finish".
i need to check if the "frog" movieclip is on the "finish" frame. but i need only do this externally (from outside of the clip, i.e. i cannot have any code inside the "frog" movieclip).
basically needs to look like this:
onClipEvent (enterFrame) {
if ("frog" is on "finish" frame) {
_root.someotherclip.gotoAndPlay(5);
}
else {
_root.someotherclip.stop;
}
}
i need to know what to put in the "if" brackets... (stuff in bold)
i just dont know how.. please help, someone.
Simple Syntax Problem
Hi everyone,
I've the bad habit of being _root happy, typing _root.varname everywhere. I was recently attempting to kick the habit, but I can't figure out a simple syntax problem...
I have this statement, currently:
Code:
for (i=1; i<hummercount+1; i++){
_root["hummer"+i]._visible=true;
}
So, _root.hummer1._visible, _root.hummer2._visible, etc. are all set.
How do I nix that _root? I've tried just ["hummer"+i]._visible but that wasn't working.
Thanks
Really Simple Syntax Problem
Okay, I want my movie to go to frame 7 and stop if a dragable movie clip is in a certain position. The problem is, my if statement isn't working.
if (dragger._x = -60) {
gotoAndStop(7);
}
Rather than checking if dragger._x does indeed equal -60, it's SETTING dragger._x TO -60.
Flash is executing the conditions in my IF statment rather than checking them.
I know this must be a simple problem to solve. Anyone help?
Simple Syntax Question
im using this expression to try add 1 to the dynamically loaded variable imnum
e.g if imnum=5 imnum should = 6 after the expression has been run.
_root.main.imnum+=1
however i keep getting a value of imnum=51
im assuming that flash is reading a number value as a string at some point.
thanks in advance
james
Simple A/S Syntax Error
hey,
What is wrong with this code?
Code:
_root.currMovie = “home”;
container.loadMovie(_root.currMovie+".swf");
This is the syntax error message i'm getting:
**Error** Scene=Scene 1, layer=Layer 43, frame=33:Line 1: Operator '=' must be followed by an operand
_root.currMovie = “home”;
Total ActionScript Errors: 1 Reported Errors: 1
i'm not to familar with A/S, someone please help me.
Thank You,
Baljinder
Simple Syntax Question
Hi, i have an onclipevent function that works just fine when it is placed on the movieclip itself, but when i try and transfer the code to the timeline, it will not work. Here is what i have on the timeline after the transfer:
code:
MC1.onEnterFrame = function() {
var speed = 22;
var xFinal = 415;
var yFinal = 47;
this._x += (xFinal - this._x)/speed;
this._y += (yFinal - this._y)/speed;
if (this._x >= xFinal && this._y >= yFinal);
trace("MC1 has reached its destination");
delete this.onEnterFrame;
}
So obviously, when it was on the movieclip itself, it was onClipEvent etc
What simple error am i making?
Gratzi.
Simple Syntax Question
Here's the deal. I have over 20 movieclips, all named "thing," then a number.
can I say something like
code:
if(_root["thing"+{for(i=0; i<20; i++)}.hitTest(_root.xxx))
{
}
the point being to acess all the thing movieclips at once without having to have 20 "&&"s and whatnot.
Help would be awesome.
Simple Syntax Error
getting a syntax error on this:
Get.onRelease = function()
(
Load Variables ("send.asp","");
)
any ideas please?
thanks
Simple Syntax Question?
Hey All,
I was editing some old code today and was curious if anyone knew the answer to this. I have say two sentances defined in a string variable and for legibility's sake I'd like to type one sentance and hit enter and type the second one so I don't have to scroll horizontally for an eternity.
In PHP you can use something along the lines of <<<END and use as many line breaks as you want without penalty. Does AS 2.0 have something along those lines so I can define the value for my string on more than one line?
Simple Syntax Questions
Hello
I need to setup a loop that does this 44 times:
if (this.c1.selected == true) {
var featurecomm1 = Fcomm[0];
var featurecomm = Number(featurecomm)+Number(featurecomm1);
theFeatures = theFeatures+"/ /"+Fdescription[0];
}
c1 will go from c1 to c44.
this is what i have but i think something is out of place:
for (i=0,i<=44,i++) {
if (this["c"+(i+1)]selected == true) {
var featurecomm1 = Fcomm[i];
var featurecomm = Number(featurecomm)+Number(featurecomm1);
theFeatures = theFeatures+"/ /"+Fdescription[i];
}
}
please help!
Simple Var Syntax Question
Hi
I have this script:
PHP Code:
var panelPressed:Boolean = new Boolean(true);
for (var i:Number = 1; i <= 6; i++) {
eval("panel"+i).onPress = function() {
if (panelPressed) {
this.swapDepths(getNextHighestDepth());
this.gotoAndPlay("grow");
this.eval("animPanel"+i).gotoAndPlay("play");
panelPressed = false;
} else {
this.gotoAndPlay("shrink");
this.eval("animPanel"+i).gotoAndStop(1);
panelPressed = true;
}
};
}
Nice and simple.. Thing is, i think this bit is wrong:
PHP Code:
this.eval("animPanel"+i).gotoAndPlay("play");
As it doesn't work!!
I suspect I've written this
PHP Code:
eval("animPanel"+i)
incorectly.
Thanks for any help.
Very Simple Syntax Question
Here's my simple question:
On my Root timeline, there's a Content Movie Clip
Inside content MovieClip there's a templatePage
Inside TemplatePage there's multimedia_movie.
I need to point to multimedia_movie.
And i write like this:
ActionScript Code:
MovieClip(this.content_mc.getChildByName("templatePage")).getChildByName("multimedia_movie")
This code seems me awful and even if it's workin' i'm wondering if there's a more elegant and correct way to write the same thing.
I hope someone will show me the way
Ciao and thanks in advance
giulio
Simple Syntax Question...
hi,
simple question:
is there a better way to do that ?
if ((this.fx>-0.1) and (this.fx<0.1)) {
this.fx = 0;
}
thanx
Simple Slash To Dot Syntax Conversion
How do you script this from slash syntax to dot syntax?
on (release) {
tellTarget ("../oneclip") {
gotoAndStop (10);
}
}
I can get it to work by saying:
_root.oneclip.gotoAndStop (10)
But I want a relative path. I know it's easy, but please help!
Simple Slash To Dot Syntax Conversion
How do you script this from slash syntax to dot syntax?
on (release) {
tellTarget ("../oneclip") {
gotoAndStop (10);
}
}
I can get it to work by saying:
_root.oneclip.gotoAndStop (10)
But I want a relative path. I know it's easy, but please help!
Simple Array Syntax Question
I made an array of 10 items (mcs used for buttons) and these buttons are used to access pieces of work for separate clients in my portfolio and with each client, there are a varied amount of these buttons activated so I need to know how to activate, for example, array items 1-4, then deactivate 5-10 but I'm not sure how to access them in clusters that way. I know I could do it:
myArray[1].deactivate = true;
myArray[2].deactivate = true;
and so on... but there are several attributes being applied to these buttons and I'm sure there must be a simpler way of doing it. Can anyone help me?
Simple Coding Problem... Need Syntax Help
hi.
i created a new MC with:
duplicateMovieClip(Obj, "Obj"+ObjNum, ObjNum);
inside the copied clip Obj there is a text field called name
i want to now write "Obj"+ObjNum.name.text="Number One" but its returns a syntax error...
I understand that I can't use "Obj"+ObjNum as a dot referrer - so how di compose this code?
Thanks!
If Statement Syntax - Simple But Frustrating
Hello everyone. I'm pulling my hair out trying to get the simplest if statement to work in flash MX. Here's what I have in frame 3 of my main movie:
fornow is a random number from 1 to 5
Hill1 through Hill5 are movie clips on my stage
If (fornow == 1) {
_root.hill1.gotoAndPlay(3);
}Else If (fornow == 2){
_root.hill2.gotoAndPlay(3);
}Else If (fornow == 3){
_root.hill3.gotoAndPlay(3);
}Else If (fornow == 4){
_root.hill4.gotoAndPlay(3);
}Else{
_root.hill5.gotoAndPlay(3);
}
Now here are the error messages I'm getting:
Scene=Scene 1, Layer=Actions 2, Frame=3: Line 9: ';' expected
If (fornow == 1) {
Scene=Scene 1, Layer=Actions 2, Frame=3: Line 11: ';' expected
}Else If (fornow == 2){
Scene=Scene 1, Layer=Actions 2, Frame=3: Line 13: ';' expected
}Else If (fornow == 3){
Scene=Scene 1, Layer=Actions 2, Frame=3: Line 15: ';' expected
}Else If (fornow == 4){
Scene=Scene 1, Layer=Actions 2, Frame=3: Line 17: ';' expected
}Else{
Why, why WHY is it doing this?
Really Simple Syntax Question On For Next Loop
gah for some reason my for next loop is repeating infinitely (i debugged it.. that IS wut it is doing.)
heres code:
Code:
for (x == 0; x<=23; x++) {
}
gah i would REALLY like an answer in next 5 min or so...
Simple Syntax Problem - Too Dumb To Fix It
}
on (release) {
}
on (release) {
}
{
if (_root._currentframe == 28) {
_root._gotoAndPlay("scene1", 29);
}
}
its giving me an error where the bold is.....something about the opening "{" i dont know where else to put it in the script.
Simple HitTest Syntax Question
Im trying to write that when the object is not on the hit object a sound will play.
I have this... it seems logical...to me...but doesnt work.
on (press){
startDrag(this);
HEY = new Sound();
Thanks = new Sound();
HEY.attachSound("HEY!");
Thanks.attachSound("Thanks");
}
on(release){
stopDrag();
if(_root.owl.hitTest !==(_root.treehole)){
HEY.start();
}
}
what is the syntax im looking for here?
Thank you for any help
Mark
Simple XML Query Using E4X Syntax Question
Let's say i have the following input xml example:
Code:
<test>
<body>
<par title="Example">
<img region="main" source="somePath"/>
<audio id="test" source="somePath2"/>
<img id="first" begin="00:00" />
<img id="second" begin="00:10" />
<img id="third" begin="00:20" />
</par>
</body>
</test>
Which i loaded from .xml file as an XML object and i would like to trace "begin" attribute value of an "img" node whose "id=second" and that would be "00:10". How can i do that, i tried with the following E4X statement:
Code:
myXML.body.par.img.(@id == "second").@begin.toXMLString())
but i get the following error in Flex Builder:
Code:
Main Thread (Suspended: ReferenceError: Error #1065: Variable @id is not defined.)
so i must have been doing something wrong but i am not sure why, can someone please help me on this?
thanks in advanced
Simple (?) Action Script Syntax Question
I have a variable named "destination" that I set based on button selections at various points.
My intent is to run some more frames then redirect the movie flow to the scene with the name that matches the value of the "destination" variable.
I can't figure out the correct syntax for the goto action, though.
Please help!!!
Thanks in advance.
Simple Syntax Problem : Return False
I am trying to make a login which will re-direct to a sub-domain, no problems in javascript. However I need this login to be in swf format
This is what I have in flash :
<code>
on (press) {
submit_btn.onRelease = function() {
getURL("javascript:GoThere(txt.value);return false;", "_self", "POST");
};
}
</code>
This calls the javascript function in the 'head' of the html page. I get the error message:
error: 'return' statement outside of function
I presume it is just a simple syntax problem.
Thanks for any clues
RigorMortis
REALLY SIMPLE SYNTAX QUESTION (the Third) ON _mousex And _mousey
wierd fro somereason i get syntax error when i do:
Code:
on (press){
mousex=_xmouse
mousey=_ymouse
_root.squarehitx=Math.floor((mousex-18)/18));
_root.squarehity=Math.floor((mousey-18)/18));
}
expanation: there is a 23x23 grid with 18x18 squares with origin point (18,18), and rather then make 23 squared buttons, i made it into 1 button that will calculate which square your on... i used the trace function to check the right side of the declarations, and they both work... its assigning that value to a variable it has a problem with... its probably a really simple answer.
you have 5 min to answer (shouldnt take that long...)
Simple Loop Syntax Problem (I Hope...)
I have this block of code to create new color objects for 6 different movieclips:
Code:
function changeColour() {
var newCol1 = new Color("chip1_mc");
var newCol2 = new Color("chip2_mc");
var newCol3 = new Color("chip3_mc");
var newCol4 = new Color("chip4_mc");
var newCol5 = new Color("chip5_mc");
var newCol6 = new Color("chip6_mc");
(some more statements here...)
}
However, recognising this code's inefficiency :-) I have tried to rewrite it using this 'for' loop:
Code:
function changeColour() {
for (i=1; i<= numberOfSwatches; i++) {
var newCol+i = new Color("swatch"+i+"_mc");
}
(some more statements here...)
}
This is generating a syntax error in the line:
Code:
var newCol+i = new Color("swatch"+i+"_mc");
Can anyone help me as to what I'm doing wrong?
Simple Syntax Problem - Detecting Current Frame
In a movie I'm doing I have 10 buttons on screen and when any of these 10 is released I want the movie to play for ten frames, then jump ahead to whatver later frames hold the content pertaining to that button.
The actionscript syntax for each button is what I can't work out. It would be something like this:
on release
play
if frame = "(frame label) / (frame number)"
go to (frame label) / (frame number)
But how do I tell the movie to detect what frame it's at? It's veey easy to ask "ifframeisloaded", but what about which frame it's actually playing? Sensing current frame number or label would do.
Any help would be useful
Quick Syntax Question About Dot-notation, Should Be A Simple Answer.
I need to dynamically determin what "field" to modify.
Example.
Code:
myMovieClip.{An expression}._visible = false;
The expression in "{}" will determin what sub movie clip of 'myMovieClip' should become invisible.
The expression could in pseudo code look something like this (I know this is wrong syntax)
Code:
"myImage" add number
where 'number' is the variable that is appended to see if it is 'myImage1', 'myImage2', 'myImage3' etc. that should become invisible.
How can I do this with actionscript??? What should that expression be.... if it is even possible. If it isnt, how else do I do it???
Hope I made it understandable I am ususally suck at explaining things
Thanx.
Onde Pik
Really Simple Syntax Thingie: Scaling A Movie Clip
rule 1: i cant do it within an on handler... or, if you can find a way, maybe.
wut i have:
a program that makes instances of a movieclipe "Newcell" and gives them the instance name "Cell[x][y]" where x and y where variables at the time of its creation that increased with each new cell being made. (the 100th one would be "cell1010"... Anyway, so it makes the movie clips. Now, RIGHT AFTER THEY"RE MADE, i'd like to scale them down to .25... so, i say:
Code:
_root.cell[x][y]._xscale == .1;
but, it retains its original size on the map, and i'm not getting any syntax errors... in other words, i just need to know how to scale a movie clip without being "inside" it... i'm sure its quite simple, but i keep trying to copy and paste other peoples examples, and none of them work (most are inside an on-handler...) oh well PLZ REPLY SOON!!!!
REALLY REALLY SIMPLE GOTOANDPLAY FRAME() SYNTAX PROBLEM- You'll Be In And Out Quickly
alright- I am no noob (well, maybe i am)-
point being- i have a slight problem. I know how to use gotoandplay and all that jazz....
But, for some reason it worketh not....
I believe the problem is:
I am trying to go to a frame that is:
1: behind me
and 2: a frame- that is, i'm trying to trigger it FROM AN MC
So, i have this mc... its located on frame 4 of scene 4- on that mc is some coding:
Code:
_root.gotoAndPlay("Scene 2",1);
Hmm.... I knoweth not y this worketh not.... please reply very soonly as this is so insanely easy compared to the rest of my program.... how could my great program be flaunted by something so small and insignificant as a visual graphic???
hmm.. do i need to use something other then .root because i'm in a movie clip? i recall using this exact thing in this exact situation prior to this one, and it worked fine... the debugger hits the step right on time, it just doesnt execute it correctly... that is, the viewer sees nothing...
BTW- i am aware that a majority of the flashing community hates scenes... well, for this purpose (a single flash puzzle game, that only requires 5 scenes- a loader, a title screen, a instruction scene, and a game scene, and a high score / "yay you won" scene) i find them quite efficient... But, I sincerely hope there is a single way to navigate between them... i know i've done this before... sometime... somewhere... hurry up and post the answer i know its somewhere.... hmm thats a song i know it... i'll remember it later...
Defining A Global Function - Simple Syntax Question
Hi guys/gals,
i have a function
Code:
function doStuff():Void{
trace("in do stuff");
}
How do i make this function a GLOBAL function? I tried
Code:
function _global.doStuff():Void{
trace("in do stuff");
}
But this doesnt seem to work. I know i can do it as follows, but how would i do it using the previous style of writing a function:
Code:
global.mydoStuff = function ():Void{
trace("in do stuff");
}
Thnaks in advance for your help
PLEASE HELP - Very Simple Issue
I need to know how to make a button within a movie go to a frame in the parent scene.
More or less, I have 1 scene and there are 2 frames in that scene. I have a movie in scene 1, and within that movie there is a button. I need to know how to make that button clickthru to frame 2 of scene 1.
PLEASE HELP I'm really stuck on what is probably a simple solution.
Thanks,
Walt
|