Archive for October, 2009

Funny Compiler Check Bug

0
Evidently, to the compiler the following is a big difference:


PASSES
return [
{label:"MyriadPro",styleName:"textDefault"}
,{label:"Albertus",styleName:"textAlbertus"}
];
FAILS
return
[
{label:"MyriadPro",styleName:"textDefault"}
,{label:"Albertus",styleName:"textAlbertus"}
];


[error message]
Severity and Description    Path    Resource    Location    Creation Time    Id
1065: Metadata attributes cannot have more than one element.    ProjectName/src/com/novelastudios/examples    FontsUtil.as    line 8    1255105753861    1317796

[/error message]


If you couldn’t tell the difference, all that is different is the bracket starts on the same line as the return in the first example. Whereas, in the second, it is on the following line.
I’m actually curious if there is a reason to the humor in this perceived “bug.” I’m going to search for a post in Adobe’s JIRA for Flex

Popularity: 5% [?]

Serialize/Clone Objects (Bug with Required Constructor Params)

0

My opinion is that the following is a big bug.

When serializing/cloning an object that has required constructor parameters, you receive an error telling you the arguments are incorrect.
Note: the following is just an example using a “native” flash class. Really, you should never have to serialize or clone an Event, so please just see it as an example class as the type of class isn’t the point.

import flash.net.registerClassAlias;
import flash.events.Event;
import mx.utils.ObjectUtil;

flash.net.registerClassAlias("flash.events.Event",Event);
var event:Event = new Event(Event.CHANGE);
var eventClone:* = ObjectUtil.copy(event);
trace(eventClone is Event)

RESULT
ArgumentError: Error #1063: Argument count mismatch on flash.events::Event(). Expected 1, got 0.
at flash.utils::ByteArray/readObject()
at mx.utils::ObjectUtil$/copy()
at Untitled_fla::MainTimeline/frame1()



As noted by Nutrox, “All constructor parameters need a default value. You can’t pass values directly to an object’s constructor when it is restored from serialised data because Flash creates an instance of the object automatically before calling the object’s readExternal() method.”



What are your thoughts? I’m interested in striking a conversation about this.





Popularity: 27% [?]

Go to Top