Reference to undeclared variable

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

Parent Message unknown Reference to undeclared variable

by Song Du :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maybe I should post to this list..

Regards,
Du Song

---------- Forwarded message ----------
From: Du Song <freewizard@...>
Date: Sat, Sep 6, 2008 at 23:52
Subject: Re: [osflash] [MTASC] Reference to undeclared variable
To: Open Source Flash Mailing List <osflash@...>


Just found one workaround:
1. use flasm -d TestDemoLucky.swf > TestDemoLucky.flm
2. remove these code:
   push 'TestDemoLucky'
   getVariable
   not
   not
   branchIfTrue label11
3. flasm -a TestDemoLucky
Don't know how to do it in mtasc way.

Regards,
Du Song



On Tue, Sep 2, 2008 at 22:44, Du Song <freewizard@...> wrote:

> Hey, Ralf,
> did you mean:
> $ cat TestDemoLucky.as
> class TestDemoLucky
> {
>        static function main(mc:MovieClip):Void
>        {
>                trace("TEST");
>        }
> }
>
> But I will still get
> Warning: Reference to undeclared variable, 'TestDemoLucky'
> in trace log
>
> Regards,
> Du Song
>
>
>
> On Tue, Sep 2, 2008 at 18:06, Ralf Bokelberg <ralf.bokelberg@...> wrote:
>> Strange, maybe it is a rare cornercase. I guess, nobody ever tried to
>> name a class with a single lowercase character. You could try to give
>> your call a different name.
>>
>> Cheers
>> Ralf.
>>
>> On Tue, Sep 2, 2008 at 7:47 AM, Du Song <freewizard@...> wrote:
>>> OSX, MTASC 1.12, Flash Player 9.0.124
>>> $ cat t.as
>>> class t
>>> {
>>>        static function main(mc:MovieClip):Void
>>>        {
>>>                trace("TEST");
>>>        }
>>> }
>>> $ mtasc-osx -header 100:100:12 -version 8 -swf t.swf -main t.as
>>> $ open t.swf
>>> [in trace]
>>> Warning: Reference to undeclared variable, 't'
>>> TEST
>>>
>>> I searched the list, someone said it's something in mx packages, but
>>> there's no mx in my code.
>>> The code is so simple, why is there still a warning?
>>>
>>> Regards,
>>> Du Song
>>>
>>> _______________________________________________
>>> osflash mailing list
>>> osflash@...
>>> http://osflash.org/mailman/listinfo/osflash_osflash.org
>>>
>>
>> _______________________________________________
>> osflash mailing list
>> osflash@...
>> http://osflash.org/mailman/listinfo/osflash_osflash.org
>>
>

--
MTASC : no more coffee break while compiling

Re: Reference to undeclared variable

by Nicolas Cannasse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Just found one workaround:
> 1. use flasm -d TestDemoLucky.swf > TestDemoLucky.flm
> 2. remove these code:
>    push 'TestDemoLucky'
>    getVariable
>    not
>    not
>    branchIfTrue label11
> 3. flasm -a TestDemoLucky
> Don't know how to do it in mtasc way.

The problem is that it's not compatible with Adobe AS2 compiler, which
never overwrite a class if it's already defined. This is why this jump
to the class end is needed.

Nicolas

--
MTASC : no more coffee break while compiling

Re: Reference to undeclared variable

by Song Du :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, Nicolas.
So there's not any way/workaround to "check if defined" without a warning?

Regards,
Du Song



On Tue, Sep 9, 2008 at 16:31, Nicolas Cannasse
<ncannasse@...> wrote:

>> Just found one workaround:
>> 1. use flasm -d TestDemoLucky.swf > TestDemoLucky.flm
>> 2. remove these code:
>>   push 'TestDemoLucky'
>>   getVariable
>>   not
>>   not
>>   branchIfTrue label11
>> 3. flasm -a TestDemoLucky
>> Don't know how to do it in mtasc way.
>
> The problem is that it's not compatible with Adobe AS2 compiler, which never
> overwrite a class if it's already defined. This is why this jump to the
> class end is needed.
>
> Nicolas
>
> --
> MTASC : no more coffee break while compiling
>

--
MTASC : no more coffee break while compiling

Re: Reference to undeclared variable

by Nicolas Cannasse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Du Song a écrit :
> Thanks, Nicolas.
> So there's not any way/workaround to "check if defined" without a warning?

Currently no, although it would be possible to add a compilation flag
for this. The problem is that there is still other limitations in the
player bytecode, such as function size, which cannot be avoided.

Nicolas

--
MTASC : no more coffee break while compiling

Re: Reference to undeclared variable

by Song Du :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for the tips.
Seems I have to forget about the scaring warnings. :)

Regards,
Du Song



On Tue, Sep 9, 2008 at 16:47, Nicolas Cannasse
<ncannasse@...> wrote:

> Du Song a écrit :
>>
>> Thanks, Nicolas.
>> So there's not any way/workaround to "check if defined" without a warning?
>
> Currently no, although it would be possible to add a compilation flag for
> this. The problem is that there is still other limitations in the player
> bytecode, such as function size, which cannot be avoided.
>
> Nicolas
>
> --
> MTASC : no more coffee break while compiling
>

--
MTASC : no more coffee break while compiling