An ActionScript 2.0 questions.

test84

GBAtemp's last ninja 2.
OP
Member
Joined
Sep 8, 2006
Messages
3,698
Trophies
1
Website
gbatemp.net
XP
1,246
Country
Iran
Hi,
I used tiles for my platform game and they are placed on different depths.
I wanted to have my HUD (like score and lives) on a different layer so I could move them around with mouse and dont mess with AttachTextField's properties like x and y when I can't actually see them.

But even if I drag the layer over my script layer, its still overrides it and shows the depths.

So I wanted to someway access that Layer that I make with Flash's Interface New Layer icon (not programitacally, just by clicking on new layer in timeline) and then move them to like depth of 13000 so it will be over everything.
 

Psyfira

Credit: 0ml. Insert tea to continue
Member
Joined
Dec 31, 2003
Messages
3,886
Trophies
0
Location
England
XP
270
Country
test84 said:
But even if I drag the layer over my script layer, its still overrides it and shows the depths.
I'm a little confused by what you mean here, are you saying the layers don't appear in the movie in the same order they are in the .fla file?
 

CockroachMan

Scribbling around GBATemp's kitchen.
Member
Joined
Jan 14, 2006
Messages
3,887
Trophies
0
Age
38
Location
Brazil
Website
www.homembarata.com.br
XP
707
Country
Brazil
You want to attach movies dynamically on your file, but keeping them under some static movies that you already have.. is that it?

Clips attached by attachMovie will be always over everything you have on stage, doesn't matter what layer are them.

I suggest you to create a movie clip for your game and a different movie clip, on a higher layer, for the HUD. Them attach stuff to the game movie clip, instead of using _root.
 

test84

GBAtemp's last ninja 2.
OP
Member
Joined
Sep 8, 2006
Messages
3,698
Trophies
1
Website
gbatemp.net
XP
1,246
Country
Iran
I wanted to have my UI arranged by mouse, not by assigning X and Y by code and thus wanted to have a Layer and put/arrange my UI there.

My game (based on TonyPaa's tutorial) is made of tiles that I place at runtime on screen and at this point I'm adding HUD (Heads Up Display, to show score or lives of player) but instead of adding game.HUD.attachTextField and mess with X and Y's that I dont actually see where they actually will be when I'm setting them and to escape from constantly trials and errors to find proper place for my HUD items, I thought why not use them Layers and add my everything there and just move depth of that Layer to be on top of everything.

I hope that clarifies.
 

test84

GBAtemp's last ninja 2.
OP
Member
Joined
Sep 8, 2006
Messages
3,698
Trophies
1
Website
gbatemp.net
XP
1,246
Country
Iran
Thats exactly what I did but that doesnt solve the problem of positioning HUD elements, I still have to use trial and error setting X and Y of HUD elements positioned, I was after ease of drag and drop which Flash UI gives you and just passing whatever you want to it.
 

Psyfira

Credit: 0ml. Insert tea to continue
Member
Joined
Dec 31, 2003
Messages
3,886
Trophies
0
Location
England
XP
270
Country
If it's a drag-and-drop text box you're after, it's on the text tool with the setting "dynamic text" (a text box which can be accessed by a script to change the contents, as long as you name each element so the script can access it).

I'll confess I'm a complete beginner to Flash, so I might be way off here, but if I've understood the question properly then google for "dynamic text box", someone else probably explains it far better than I can
smile.gif
 

CockroachMan

Scribbling around GBATemp's kitchen.
Member
Joined
Jan 14, 2006
Messages
3,887
Trophies
0
Age
38
Location
Brazil
Website
www.homembarata.com.br
XP
707
Country
Brazil
test84 said:
Thats exactly what I did but that doesnt solve the problem of positioning HUD elements, I still have to use trial and error setting X and Y of HUD elements positioned, I was after ease of drag and drop which Flash UI gives you and just passing whatever you want to it.

Check the "localToGlobal" and "globalToLocal" functions to convert your x,y coordinates.. you're probably using local ones..
 

test84

GBAtemp's last ninja 2.
OP
Member
Joined
Sep 8, 2006
Messages
3,698
Trophies
1
Website
gbatemp.net
XP
1,246
Country
Iran
Thank you both Psyfira and my favourite insect,

A-
@RochGuy:
My problem is not with local X or global X, my problem is that I dont like to imagine what x=120 y=200 will be and try to see how bad/good it turned out, I want to drag around txtBoxes and set them to my game's variables, thats all doable the problem is I want to put all my HUD stuff in a seperate layer and put it on top of everything else, thats not doable since I can put my HUD stuff on a layer and its working but it will get buried under my game's tiles, so I have to change its depth to something like 20000 in order to have it on top of anything else, but I cant access layer's deptr.

I'm gonna stick with my game.HUD mode, which I dont like

Someone somewhere else answered someone's question that layers are nothing but some depth that flash is wrapping in Layers, I think thats why I cant find proper methods for it.

------------------
B-
Another question.

I'm blinking my character at certain condition and as I investigated, the best solution around is using setInterval and clearInterval but as far as I read, most if not all's solution for clearInterval's ID number was to make it public in the form.

That solution is working but I was after a better one (since global variables is obsolete and will/would cause problem when your program is increasing in size AND ) so I made this topic to ask about other's opinions about a better solution for dealing with the scope of number needed in clearInterval.


Another reason is that I'm having my enemies killed by a fading animation which I
use and I need to keep track of setInterval ID's properly for them too.
 

test84

GBAtemp's last ninja 2.
OP
Member
Joined
Sep 8, 2006
Messages
3,698
Trophies
1
Website
gbatemp.net
XP
1,246
Country
Iran
thnx,
If you are answering my B question, actually the problem is in scope of IntervalID's.

I think the best solution is to add the ID to each object and access it via that whenever needed.
 

Site & Scene News

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: You woke sob +2