Hello,
the problem might be caused by the { and } you place around you switch statements. The following code works just fine.
Greetz Erik
public function testAS()
{
var x1:Object = {type: "x", data: {a: 1}};
var x2:Object = {type: "x", data: {a: 2}};
var y1:Object = {type: "y", data: {a: 3}};
var y2:Object = {type: "y", data: {a: 4}};
check(x1);
check(x2);
check(y1);
check(y2);
};
private function check(o:Object):void
{
switch (o.type)
{
case "x":
switch (o.data.a )
{
case 1:
trace("1 X");
break;
case 2:
trace("2 X");
break;
};
break;
case "y":
switch (o.data.a)
{
case 3:
trace("3 Y");
break;
case 4:
trace("4 Y");
break;
};
break;
};
};
{
var x1:Object = {type: "x", data: {a: 1}};
var x2:Object = {type: "x", data: {a: 2}};
var y1:Object = {type: "y", data: {a: 3}};
var y2:Object = {type: "y", data: {a: 4}};
check(x1);
check(x2);
check(y1);
check(y2);
};
private function check(o:Object):void
{
switch (o.type)
{
case "x":
switch (o.data.a )
{
case 1:
trace("1 X");
break;
case 2:
trace("2 X");
break;
};
break;
case "y":
switch (o.data.a)
{
case 3:
trace("3 Y");
break;
case 4:
trace("4 Y");
break;
};
break;
};
};
output:
1 X
2 X
3 Y
4 Y
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Software development tool | Software development | Software development services |
Home design software | Software development company |
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___