Newbie question: if parsing error

View: New views
4 Messages — Rating Filter:   Alert me  

Newbie question: if parsing error

by sloopy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
I am new to mtasc.  I was using SWF::Builder ( perl module ) to create
swf files, but I would like to use Actionscript2.
I tried to compile some of my old code using mtasc, but it doesn't work.
When I try to compile a file with:

 if (this.proj == undefined) {
    this.proj = 'projmerc';
}

I get this error:
 parse error Unexpected if

But when I look up the Actionscript "if", it shows that I am using it
correctly.
What am I doing wrong or missing?
Thank you for any help.
Shannon


--
MTASC : no more coffee break while compiling

Re: Newbie question: if parsing error

by tom/formrausch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Shannon,

your syntax is correct.
Could you post the sourcecode right before this part?

btw a shorter way to write this is

this.proj = this.proj || 'projmerc'

--tom

On Jul 11, 2007, at 4:38 PM, Shannon Scott wrote:

> Hello,
> I am new to mtasc.  I was using SWF::Builder ( perl module ) to  
> create swf files, but I would like to use Actionscript2.
> I tried to compile some of my old code using mtasc, but it doesn't  
> work.
> When I try to compile a file with:
>
> if (this.proj == undefined) {
>    this.proj = 'projmerc';
> }
>
> I get this error:
> parse error Unexpected if
>
> But when I look up the Actionscript "if", it shows that I am using  
> it correctly.
> What am I doing wrong or missing?
> Thank you for any help.
> Shannon
>
>
> --
> MTASC : no more coffee break while compiling


--
MTASC : no more coffee break while compiling

Re: Newbie question: if parsing error

by Julien De Luca-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

When compiling with mtasc, you should use the "main entry point" method,
which is a static method from which the compiler starts interpreting the
code. That may force you to rewrite your code a little, and some other
code which complied well with the builtin flash compiler (from the flash
ide) may not work with mtasc, mtasc being a little more strict than the
macromedia/adobe compiler.

I am not sure if this method is mandatory or not, but i think so. (anyone ?)

The best is to go to mtasc website or osflash.org to get more infos.

Good luck.
Jidé.

Shannon Scott a écrit :

> Hello,
> I am new to mtasc.  I was using SWF::Builder ( perl module ) to create
> swf files, but I would like to use Actionscript2.
> I tried to compile some of my old code using mtasc, but it doesn't work.
> When I try to compile a file with:
>
> if (this.proj == undefined) {
>    this.proj = 'projmerc';
> }
>
> I get this error:
> parse error Unexpected if
>
> But when I look up the Actionscript "if", it shows that I am using it
> correctly.
> What am I doing wrong or missing?
> Thank you for any help.
> Shannon
>
>


--
MTASC : no more coffee break while compiling

Re: Newbie question: if parsing error

by sloopy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for the quick responses.
I think my problem was that mtasc requires a real class with a "main
entry point" method.
I've moved beyond the error.
Thanks again.
Shannon


Julien D wrote:

> Hi,
>
> When compiling with mtasc, you should use the "main entry point"
> method, which is a static method from which the compiler starts
> interpreting the code. That may force you to rewrite your code a
> little, and some other code which complied well with the builtin flash
> compiler (from the flash ide) may not work with mtasc, mtasc being a
> little more strict than the macromedia/adobe compiler.
>
> I am not sure if this method is mandatory or not, but i think so.
> (anyone ?)
>
> The best is to go to mtasc website or osflash.org to get more infos.
>
> Good luck.
> Jidé.
>
> Shannon Scott a écrit :
>> Hello,
>> I am new to mtasc.  I was using SWF::Builder ( perl module ) to
>> create swf files, but I would like to use Actionscript2.
>> I tried to compile some of my old code using mtasc, but it doesn't work.
>> When I try to compile a file with:
>>
>> if (this.proj == undefined) {
>>    this.proj = 'projmerc';
>> }
>>
>> I get this error:
>> parse error Unexpected if
>>
>> But when I look up the Actionscript "if", it shows that I am using it
>> correctly.
>> What am I doing wrong or missing?
>> Thank you for any help.
>> Shannon
>>
>>
>
>


--
MTASC : no more coffee break while compiling