00:00
00:00
Newgrounds Background Image Theme

Jmurr12 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

actionscript 3.0 sample question...

489 Views | 4 Replies
New Topic Respond to this Topic

=====================
var object:Object = {};
object[ 158 ] = "String";
=====================
How do I use the "String" to get 158...........thank you help me

Response to actionscript 3.0 sample question... 2012-05-03 06:57:29


At 5/3/12 06:42 AM, america190 wrote: =====================
var object:Object = {};
object[ 158 ] = "String";
=====================
How do I use the "String" to get 158...........thank you help me

It's possible but not easy to do. If "String" is your key in your hash, use it as a key:

object["String"] = 158;

If you have to insist on using 158 as key and "String" as value, please elaborate more on what you want to do.

Response to actionscript 3.0 sample question... 2012-05-03 07:07:40


At 5/3/12 06:57 AM, milchreis wrote:
At 5/3/12 06:42 AM, america190 wrote: =====================
var object:Object = {};
object[ 158 ] = "String";
=====================
How do I use the "String" to get 158...........thank you help me
It's possible but not easy to do. If "String" is your key in your hash, use it as a key:

object["String"] = 158;

If you have to insist on using 158 as key and "String" as value, please elaborate more on what you want to do.

============================================================
=========================

thank you very much!
this is my writ code

var object:Object = {};
object[ 0 ] = "goto1";
object[ 1 ] = "goto2";
object[ 2 ] = "goto3";
object[ 3 ] = "goto4";

when I know this value, i want get the value corresponding to the position.

Response to actionscript 3.0 sample question... 2012-05-03 08:01:37


At 5/3/12 07:07 AM, america190 wrote: this is my writ code

var object:Object = {};
object[ 0 ] = "goto1";
object[ 1 ] = "goto2";
object[ 2 ] = "goto3";
object[ 3 ] = "goto4";

when I know this value, i want get the value corresponding to the position.

Why do you use Object and not Array?
It's still not enough information, what do you want to achieve in the end?

You could substring the last character of the String, but your code looks like you're doing something very wrong.

Response to actionscript 3.0 sample question... 2012-05-03 21:38:04


when I know this value, i want get the value corresponding to the position.
Why do you use Object and not Array?
It's still not enough information, what do you want to achieve in the end?

You could substring the last character of the String, but your code looks like you're doing something very wrong.

ouï¼OE i understand... use for ( var b* in Object )..

===code
public function getRaidMapId( raidId:int ):int
{
for ( var pi:* in _raidMap )
{
for each( var pj:RaidVO in _raidMap[pi] )
{
if ( pj.id == raidId )
return pi;
}
}
return 0;
}