Be a Supporter!

AS2 problem

  • 376 Views
  • 7 Replies
New Topic Respond to this Topic
TheSexualHero
TheSexualHero
  • Member since: Oct. 18, 2012
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
AS2 problem 2013-01-19 12:09:39 Reply

I have problem with copies in flash... Some codes arent working for duplicate's of some movieclip...
like this:
http://img194.imageshack.us/img194/5392/helpqy.jpg

help pls? :$

Barzona
Barzona
  • Member since: Jan. 4, 2009
  • Offline.
Forum Stats
Member
Level 13
Game Developer
Response to AS2 problem 2013-01-19 12:35:02 Reply

At 1/19/13 12:09 PM, TheSexualHero wrote: I have problem with copies in flash... Some codes arent working for duplicate's of some movieclip...
like this:
http://img194.imageshack.us/img194/5392/helpqy.jpg

help pls? :$

Everyone is going to tell you to switch to AS3 and they will be right, but starting with AS2 isn't all that bad as long as you change eventually.

Add all of your ground objects to an array and then use a for loop to hittest your player against them. I hope you can do that in AS2.

GMR516
GMR516
  • Member since: Oct. 11, 2011
  • Offline.
Forum Stats
Member
Level 13
Programmer
Response to AS2 problem 2013-01-20 18:20:46 Reply

You know your FIRST ground_mc? Draw the extra grounds in there. i'm guessing that your checking by instance names, and duplicate instance names won't work in Flash AS2, (dunno about 3) so just draw the REST of the grounds in your first MC. It should work.


Don't click me. Please.
^ DON'T CLICK IT.
^ DON'T LISTEN TO THAT.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Supporter
Level 05
Game Developer
Response to AS2 problem 2013-01-20 18:33:18 Reply

At 1/20/13 06:20 PM, GMR516 wrote: i'm guessing that your checking by instance names, and duplicate instance names won't work in Flash AS2, (dunno about 3)

it won't work in 3, either, but that's because it's a variable and not an "instance nam-"
you know what? Just learn AS3. For the love of all that is holy, do it.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to AS2 problem 2013-01-20 20:08:22 Reply

What you'll need to do is place the objects in an Array and loop though them, by the time you've done it correctly you'll be abandoning instance names and junk. It's probably a good idea to make the switch.


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature
FlyingColours
FlyingColours
  • Member since: Jul. 3, 2011
  • Offline.
Forum Stats
Member
Level 06
Programmer
Response to AS2 problem 2013-01-30 07:06:39 Reply

At 1/20/13 06:33 PM, egg82 wrote:
At 1/20/13 06:20 PM, GMR516 wrote: i'm guessing that your checking by instance names, and duplicate instance names won't work in Flash AS2, (dunno about 3)
it won't work in 3, either, but that's because it's a variable and not an "instance nam-"
you know what? Just learn AS3. For the love of all that is holy, do it.

I have to agree with Barzona. I'm still using AS2, I'm not going to migrate to AS3 for another couple of years, and I'm not ashamed of it. :P

Just wanted to offer some extra perspective on the issue. When variables have the same scope, they can't have the same name. That means if you can access both variables in the same way (e.g. they're in the same function, same instance, same class...), they must each have a unique name. Any variables you declare on the main timeline are dynamic properties - properties that are not defined in the class definition, but dynamically added there with code during runtime - of the main timeline.) While AS2 does allow multiple variable declarations on a timeline, the first variable will be masked and cannot be accessed until the second one dies and is removed. (Multiple variable declarations in a class definition are not allowed.)

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Supporter
Level 05
Game Developer
Response to AS2 problem 2013-01-30 09:54:58 Reply

At 1/30/13 07:06 AM, FlyingColours wrote: I have to agree with Barzona. I'm still using AS2, I'm not going to migrate to AS3 for another couple of years, and I'm not ashamed of it. :P

you code in AS2 properly. I don't honestly know what to say about that.
i've actually done some proper AS2 coding before, and it's all well and good, but AS3's structure is just more logical (and thus simpler). You don't need to jump through any fancy hoops to get classes to work. Plus, you get a bunch more built-in classes and thus a bunch more freedom in what you want to do.

but it's up to you, I suppose.

at any rate, you are correct (both AS2 and AS3, though there's some rules with variables having the same name in AS3. For the most part, the rules are "don't do it.")


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to AS2 problem 2013-01-30 16:46:01 Reply

At 1/30/13 07:06 AM, FlyingColours wrote:

Make sure you're actually using proper AS2 and not some thrown together AS1.


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature