07-14-2008, 04:46 PM
|
#1
|
|
Senior Member
Join Date: Feb 2006
Location: Washington, DC
Posts: 2,718
|
Problem with continue statement and label statement
What am I doing wrong?
ActionScript Code:
var a = {
a:[1,2,3,4,5,6,7,8,9,0],
b:[1,2,3,4,5,6,7,8,9,0],
c:[1,2,3,4,5,6,7,8,9,0],
d:[1,2,3,4,5,6,7,8,9,0],
e:[1,2,3,4,5,6,7,8,9,0],
f:[1,2,3,4,5,6,7,8,9,0],
g:[1,2,3,4,5,6,7,8,9,0]
}
outerLoop: for(var i in a){
trace(i);
for(var j in a[i]){
trace(' '+j);
continue outerLoop;
}
}
Quote:
|
1039: Target of continue statement was not found.
|
|
|
|
07-14-2008, 09:01 PM
|
#2
|
|
Holosuit User
Join Date: Oct 2006
Location: Tel Aviv
Posts: 4,299
|
Huh... tested it again. Seems to be a bug, whenever I try to use continue on labeled for-in or for-each loop it spits at me some hundred lines of stack trace and finally ends up in
Code:
VerifyError: Error #1068: int and * cannot be reconciled.
at Untitled_fla::MainTimeline/Untitled_fla::frame1()
If you need a workaround, you may use Proxy class. It allows overriding for-in looping of object's properties... And, may be, submit the bug report to Adobe here:
http://www.adobe.com/cfusion/mmform/...?name=wishform
Last edited by wvxvw; 07-14-2008 at 09:26 PM.
|
|
|
07-14-2008, 09:36 PM
|
#3
|
|
Senior Member
Join Date: Feb 2006
Location: Washington, DC
Posts: 2,718
|
Ah... but 'continue' works fine in a for..in/each loop:
ActionScript Code:
var a = [0,1,2,3,4,5,6,7,8,9];
for(var i in a){
if(a[i] > 4) continue;
trace(a[i])
}
I guess it's a bug just when you use a label to target an outer loop...
|
|
|
04-07-2011, 03:06 PM
|
#4
|
|
Registered User
Join Date: Apr 2011
Posts: 1
|
this piece works fine with continue and label
Loop1:for each (var feature:Feature in featuresArr)
{
Loop2:for each (var myIndicator:Indicator in myIndicatorArray)
{
if (myIndicator.dataType == "int")
{
var crtVal:Number = Number(myIndicator.getVal(feature));
if (isNaN(crtVal))
continue Loop1;
trace("crtVal "+crtVal);
}
}
returnList.push("temp");
}
|
|
|
04-07-2011, 06:21 PM
|
#5
|
|
Holosuit User
Join Date: Oct 2006
Location: Tel Aviv
Posts: 4,299
|
The first one was a for-in loop, that's not the same as for-each... but times changed since that was posted. It could've been fixed since then (the post is almost 3 years old, it was FP9 then).
|
|
|
04-08-2011, 10:30 PM
|
#6
|
|
Senior Member
Join Date: Feb 2006
Location: Washington, DC
Posts: 2,718
|
Hey I remember this. Never got it working. I just tried my original code again and got lots of crazy bytecode errors, culminating in:
Quote:
|
VerifyError: Error #1068: int and * cannot be reconciled.
|
Not sure what that means. I tried adding variable typing and got the same error. I'm also not sure why I was doing trace(' ' + j) instead of trace(j) but that didn't make a difference.
|
|
|
04-09-2011, 09:53 AM
|
#7
|
|
Holosuit User
Join Date: Oct 2006
Location: Tel Aviv
Posts: 4,299
|
That would mean that the compiler had generated invalid assembly - this error means that the value on stack isn't convertible to integer. It's hard to say what was on stack when it crashed, and why would it try to convert it to integer. You'd need to disassemble the function and see what exactly it does. I'm a bit too lazy to do it now
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 12:36 PM.
///
|
|