Weird behaviour in Flash actionscript
December 18th, 2005 by Sonja DuijvesteijnI’ve been working on some flash stuff lately, building a semi 3d world through which one can roam somewhat freely. However I found some weird behaviour in Flash. Apparently, new means second hand.
The as class
class Line {
var values_arr = new Array();
function Line() {
}
function setArrayValue(i:Number):Void {
values_arr.push(i);
}
function getValue():Array {
return(values_arr);
}
}
The code
for(var i = 0; i < 10; i ) {
var line:Line = new Line;
line.setArrayValue(1);
}
trace(line.getValue());
Result of the trace
1,1,1,1,1,1,1,1,1,1
This is easily solved by putting the ‘new array()’ not in the variable declaration but in the constructor function. But why would flash use an old object if you make it with ‘new’?
Related posts
No related posts.
October 2nd, 2008 at 3:46
How i may contact admin this site? I have a question.
iijiivei
October 22nd, 2008 at 12:51
washington state raffle lottery casino online gambling mountain hotel casino reno
October 26th, 2008 at 3:33
Your Web Site is really wonderful and I bookmarked it. Thank your for the hard work you must have put in to create this wonderful facility. Keep up the excellent work!
November 15th, 2008 at 7:50
to: Admin - If You want to delete your site from my spam list, please sent url of your domain to my emai: stop.spam.today@gmail.com
And I will remove your site from my base within 24 hours
webmastegz
November 17th, 2008 at 2:05
to: Admin - If You want to delete your site from my spam list, please sent url of your domain to my emai: stop.web.spam@gmail.com
And I will remove your site from my base within 24 hours
webmastegz
PS. As the previous address of an e-mail has been removed also all letters on it have been lost I is compelled to make this dispatch once again.
PS2. To send url your site on an e-mail stop.web.spam@gmail.com is a unique way to avoid a spam from me. To write abuses to the various “stop spam” sites - it is useless.
PS3. Your addresses of an e-mail are not necessary to me, you can create an e-mail through free service and send me yours url through this e-mail
PS4. sorry for my bad English :)
November 18th, 2008 at 11:06
The site very professional! Keep up the good work! Oh yes, one extra comment - maybe you could add more pictures too! So, good luck to your team!
November 20th, 2008 at 1:12
Hi! I wish to buy a levitra for impotence treatment. Somebody already used it? What was effect?
November 22nd, 2008 at 3:30
to: Admin - If You want to delete your site from my spam list, please visit this site for instructions: remove-url.co.cc
December 4th, 2008 at 9:01
lexington investment mortgage co http://usaquotes.us/student-loan.html mortgage myers internet tx 972
February 5th, 2009 at 1:16
Hello to all :) I can’t understand how to add your site in my rss reader. Help me, please
August 3rd, 2009 at 8:03
classes needed for a pharmacy tech http://royaldrugstore.info/catalogue/h.html drugs online pharmacy
August 4th, 2009 at 12:49
medicine and surgery of south american camelids http://royaldrugstore.info/product/lopressor.html bodybuilding gay
August 6th, 2009 at 8:24
two major veins in pigs heart that return deoxygenated blood http://royaldrugstore.info/category/stop-smoking.html christian science and the right to choose medical treatment
August 17th, 2009 at 10:51
Online Dating Service http://loveepicentre.com Love
August 18th, 2009 at 2:46
medical authorization letter http://legalrxdrugstore.com/#q22?cv=eu hipaa medical software
August 20th, 2009 at 6:09
family health insurance plans htm http://pharmacyrxworld.info/item.php?id=5181&lng=us&cv=us irvine regional medical center
September 2nd, 2009 at 4:24
Romance http://loveepicentre.com Couples
May 24th, 2010 at 7:22
Just want to say what a great blog you got here!
I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!
Thumbs up, and keep it going!
Cheers
Christian, VideoChat with Amateur Girls at Home Alone!
May 29th, 2010 at 12:24
Just want to say what a great blog you got here!
I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!
Thumbs up, and keep it going!
Cheers
Christian, iwspo.net
June 1st, 2010 at 4:27
Just want to say what a great blog you got here!
I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!
Thumbs up, and keep it going!
Cheers
Christian,Diet Guide!
June 7th, 2010 at 3:36
Just want to say what a great blog you got here!
I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!
Thumbs up, and keep it going!
Cheers
Christian,Earn Free Vouchers / Cash