PDA

View Full Version : "missing ; before statement" error


Kantemir
05-11-2006, 01:45 PM
Iīm trying to make a command en Flash 8, to assign a specific action to a MC.

I have a layer called actions al the top, and under that one, a layer called "TAG". In this layer there is a MC called "tag". I want to assign an action to that mc called "tag".

This is the code in the .jsfl file

// turn layers visible
fl.getDocumentDOM().getTimeline().setLayerProperty ('visible', true);

// Select none
fl.getDocumentDOM().selectNone();

// Click to select the object at the top.
fl.getDocumentDOM().mouseClick({x:48, y:18}, false, true);

// Add the action
fl.getDocumentDOM().getTimeline().layers[1].frames[0].elements[0]
.actionScript = "on(release) {fscommand("URL1");}";

// Save de doc
fl.getDocumentDOM().save();

// Publish it
fl.getDocumentDOM().publish();

// Close it
fl.getDocumentDOM().close(false);

// End.

When I run de command I get the error
http://img80.imageshack.us/img80/1783/missingbefore0xd.jpg


I really donīt know if there is an easier way to make the action aplies to an specified object, in this case, the "tag" mc.

Thanks for your help!

This was my 1st post... :cool:

tg
05-11-2006, 03:24 PM
change this line like this:

.actionScript = "on(release) {fscommand('URL1');}"; //note single quotes around url


if url1 is a variable then you need to do:

.actionScript = "on(release) {fscommand(' " +URL1+" ');}";

tg
05-11-2006, 03:25 PM
looking at your code again.... im not sure if either will fix the problem....

... ok, so read my footer now.

Kantemir
05-11-2006, 04:45 PM
This way didnīt show me the error message...



.actionScript = "on(release) {fscommand('URL1');}"; //note single quotes around url



but.. it didnīt work... the action was not applied to the "tag" symbol. I think Iīm doing something wrong in the select sentece.. is there another way to target the action to an specified symbol?

Thank you tg! :)

tg
05-11-2006, 05:23 PM
i dont know anything about jsfl.... you might pm one of the moderators and ask them to move this to the jsfl forum.... will likey get better/more responses there.

Kantemir
05-11-2006, 06:40 PM
Oops... I didnīt seethat forum, jeje. :P

aravinth_vt
05-18-2006, 02:15 PM
Hi,

In that layer called "TAG" is there only one movieClip or is there more than one?

Kantemir
05-19-2006, 05:02 PM
There is only one.

aravinth_vt
05-22-2006, 08:27 AM
var layerName=prompt("Enter the layer name ","TAG");
//var yourScript="on(release){\n trace(\"its working\") \n}";
var yourScript=prompt("Enter the code to apply","on(release){trace(\"its working\")}");

applyScript(layerName,yourScript);

//----------------------- functions ---------------------------------------
function applyScript(layerName,yourScript){
var doc=fl.getDocumentDOM();
var timeline=doc.getTimeline();
var layers=timeline.layers;
for(i in layers){
if(layers[i].name==layerName){
timeline.currentLayer=Number(i);
timeline.setLayerProperty("locked",false,"all");
timeline.setLayerProperty("locked",true,"others");
doc.selectNone();
doc.selectAll();
if(doc.selection.length==1){
doc.selection[0].actionScript=yourScript;
}else{
alert("It will not work for mulitple selection");
}
//fl.trace(layers[i].name);
return;
}
}
}
//------------------------------ end --------------------------------------

I have tried some code please check this one , its working.

Kantemir
05-22-2006, 01:50 PM
mm.. you script works perfect. :)

But I get an error when I try this

var yourScript=prompt("Enter the code to apply","on(release){getURL(clickTag, "_blank");}");

http://img231.imageshack.us/img231/3627/error29nh.jpg

Now... is there a way to do this without prompt? I mean.. apply the action to de object in the layer "boton" always?

Than you very much for your help. :rolleyes:

aravinth_vt
05-23-2006, 07:56 AM
Please try this one below instead of that one,

var yourScript=prompt("Enter the code to apply","on(release){getURL(clickTag, \"_blank\");}");

when ever a string is going to come inside a string use \", for example

"my name is \"aravinth\" " is the right method, "my name is "aravinth"" is a wrong way to write.

and to do it for the layer "boton" change the initial variable like below

var layerName="boton";

instead of this line,

var layerName=prompt("Enter the layer name ","TAG");

this will stop the prompt.:)

aravinth_vt
05-23-2006, 08:02 AM
happy to know its working well :)

Kantemir
05-23-2006, 10:02 PM
"It will not work with multiple selection"??? And now.. what is this error msg? What Iīm doing wrong?

I owe you a favor man.. really thank you.