bugGnash - The GNU Flash player - Bugs: bug #18197, ActionScript variables broken

 
 

bug #18197: ActionScript variables broken

Submitted by:  Udo Giacomozzi <udog>
Submitted on:  Sat 04 Nov 2006 01:00:38 PM UTC  
 
Category: ActionScriptSeverity: 3 - Normal
Release: NoneStatus: Fixed
Privacy: PublicAssigned to: Sandro Santilli <strk>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 27 Nov 2006 12:05:45 AM UTC, comment #4:

Udo, IIRC an automatic 'primitive string' to "String Object" conversion was implemented in the code, so if you want to go on with the self-contained test case that'd be great.

I just committed a new section in the Gnash manual:
"Writing self-contained SWF tests with other compilers"

If there's anything you don't understand let me know and
I will update/fix/explain.

About your question "what is xtrace": forget it, use the
note() function from Dejagnu.swf :)

Sandro Santilli <strk>
Project MemberIn charge of this item.
Sat 04 Nov 2006 06:29:34 PM UTC, comment #3:

Looks like you're right!

-- new code --

var myname=this._name;
trace("myname="+myname);
trace("typeof myname="+typeof myname);

var anystring=new String(myname);
trace("typeof anystring="+typeof anystring);

var i=anystring.indexOf("_");
trace("i="+i);

var ID=anystring.substr(i+1);
trace("ID="+ID);

-- flash output --

myname=key_foo
typeof myname=string
typeof anystring=object
i=3
ID=foo

Cannot test this with Gnash ATM as I have no access to a Linux system right now.

What's exactly xtrace?

Udo Giacomozzi <udog>
Project Member
Sat 04 Nov 2006 03:08:09 PM UTC, comment #2:

Another suggestion (continuing in the self-contained testcases thread). The "framework" should include (additionally to the fail/pass/xfail/xpass functions, an 'xtrace' function appending lines to a textfield (gnash-supported, possibly - so no drawing api).

By using the xtrace (so that gnash also prints it) you could trace
typeof this._name
also,
typeof new String
so we can see if _name is originally a String object or if it
is impicitly converted to a String object when indexOf method
is invoked...

... well, and so on with more tests on the types ...

Like: check(this._name.prototype == String.__proto__) ?

Sandro Santilli <strk>
Project MemberIn charge of this item.
Sat 04 Nov 2006 02:49:46 PM UTC, comment #1:

Yes, we have two kind of strings: String objects (ActionScript object) and 'primitive' strings.
So far the only way to obtain a string is to use the String
constructor.
I guess Flash returns ._name as of an actual String object
instead. How could you confirm this ?

Do you wat to try substituting '_name' with a literal string
in your ActionScrip to see if it would fail in that case
for MM player too ?

Sandro Santilli <strk>
Project MemberIn charge of this item.
Sat 04 Nov 2006 01:00:38 PM UTC, original submission:

I made a very simple ActionScript test movie (attached). It contains a simple MovieClip ("mc") that's also added to the stage (instance name "key_foo"). The MovieClip itself contains a few ActionScript lines:

var myname=this._name;
trace("myname="+myname);

var i=myname.indexOf("_");
trace("i="+i);

var ID=myname.substr(i+1);
trace("ID="+ID);

--- Flash output ---
myname=key_foo
i=3
ID=foo

--- Gnash output ---
13:55:48: myname=key_foo
13:55:48: ERROR: call_method invoked in something that doesn't cast to an as_object: key_foo
13:55:48: i=
13:55:48: ERROR: call_method invoked in something that doesn't cast to an as_object: key_foo
13:55:48: ID=

Seems like the string object is not being recognized as a AS object?

Same result when using directly this._name.substr(...) or when explicitely make _name a string by adding a "X" suffix (_name+"X").

Udo Giacomozzi <udog>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #11158:  astest.swf added by udog (422B - application/x-shockwave-flash - extended test)
file #11155:  astest.swf added by udog (331B - application/x-shockwave-flash - Demo movie)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by strk (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 12 Dec 2006 01:26:45 AM UTCstrkStatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
    Mon 27 Nov 2006 12:05:45 AM UTCstrkStatusNone=>Need Info
      Assigned toNone=>strk
    Sat 04 Nov 2006 06:29:34 PM UTCudogAttached File-=>Added astest.swf, #11158
    Sat 04 Nov 2006 01:00:39 PM UTCudogAttached File-=>Added astest.swf, #11155

    Back to the top


    Powered by Savane 3.1-cleanup1