Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Dictionary Of Co-ordinates? Or What?


I'm planning to implement a a tiling background of loaded bitmaps.

Because I can't hold the whole map in memory at once, I figure when a bitmap is off-screen, it should be available for garbage collection. But if it comes back on screen and hasn't been collected, I want to be able to put it back in the display list without needing to reload it.

But I'm new to AS3, and don't fully understand this weak reference thing. I'll want to be able to access the bitmaps according to an X and Y index, so I initially thought of using an array of arrays to store them. But arrays don't allow weak references.

I can use a dictionary with weak references, but in that case I don't see how I can reference an object based on its X and Y co-ordinates so I can see if it still exists.




ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 12-10-2007, 10:54 PM


View Complete Forum Thread with Replies

Sponsored Links:

Co-ordinates
can someone please tell me why the co ordinates wont work? the replacement object just shows up in the top corner at (0,0) (i think) any ideas whats wrong?

on (press) {
startDrag ("");
}
on (release) {
stopDrag ();

_root.depthvar++
_root.attachMovie( "leafmoexp", "leafmoexp"+ _root.depthvar, _root.depthvar );

_root[["leafmoexp"+ _root.depthvar]._x ==35.9];
_root[["leafmoexp"+ _root.depthvar]._y ==94.6];
}

View Replies !    View Related
_x / _y Co-ordinates
Hi...
I'm using attachMovie method to place movies
on the stage. But because I can't see them until I
test my movie, I am placing a box where I want my
movie clip to appear, and taking the x/y co-ordinates
from the property inspector.

However, using these co-ords. in the attachMovie params.
_x and _y , They don't line up, and I have to poke and
hope until I get it right.

I have now found the co-ords for the movie I am working
on at this time. But even using these, sometimes a clip
appears on the stage very large and not starting at
those co-ords.

I'm making the clips by cutting and pasting frames
into a new movie symbol. but not sure at what stage I
should be sizing them. ?

Any comments/advice would be greatly appreaciated.

View Replies !    View Related
X,y Co-ordinates
My .swf loads no problem, but I need to place it at a specific location in the mc it loads into.

This is my current code, grateful for any x and y code tips:

on (release) {
loadMovie("video.swf", "_root.mainMovie.r&JVideo");
}

View Replies !    View Related
Xy Co-ordinates
Is there any logical way of finding the xy co-ordinates in Flash 5, besides guessing?

Thanks, Plog.

View Replies !    View Related
Co-ordinates
hi guys,

I was wondering if anyone knew what the maximum _x and _y co-ordinates are in flash.

eChimp!!

View Replies !    View Related
X And Y Co-ordinates
ok just experementing again i was wondering if i could get a dynamic txt box to show the x and y co-ordinates of where the mouse is at the time.

code:
_root.boo.text = _xmouse;


this works but it doesnt update so where ever the mouse is when the move first loads thats what number comes up, is there a way for it to keep changing?

View Replies !    View Related
Co-ordinates
hello,

I am trying to, when the user presses control to move this movie clip to a certain location.

I tried this code and I don't know why it isn't working.(this code is in the movie clip to be moved to a co-ordinate)


onClipEvent(load){
if (Key.isDown(17)){
_x = _root.player._x;
_y = _root.player._y;
}
}


Thankyou Very much to anybody who helps!

View Replies !    View Related
Set X & Y Co-Ordinates
Hi

I need to reset the positions of movieclips in each frame. It is a drag and drop game and after each stage I need to have the movieclips go back to their original places.

I have been unable to figure out or find how to set the x and y co-ordinates at the beginning of each frame.

Any help is much appreciated

David

View Replies !    View Related
Dictionary
i need a list of all the flash mx actionscript commands and what they doi.

View Replies !    View Related
Dictionary - XML Or TXT
Hi! I'm trying to integrate a flash movie with external data. I'm not sure if I should use XML or TXT and would appreciate some advice. The scenary is like this:
-I have a database with four records: Word, Explanation, Illustration, Video.
-The flash document should be one static page with one field for each of the records.
-Word field should be a search field and combo box.
-Explanation field should load when the corresponding word is selected. There should be links from words in the explanation field to corresponding words in the word field.
-Video field should load and play when the corresponding word is selected.
-Illustration field should be an internal link to an illustration

My problems are:
-Should I use XML or TXT for the data (Words, Explanation)?
-How do I in an easy way connect the data from the external file to the flash document?

I'm sure I'll come up with a lot of more questions later but that's enough for today. I have made an illustration of how I imagine the user interface should look like.

View Replies !    View Related
Dictionary Contains Key?
What is the correct way to determine if a Dictionary contains a particular key or not?

In Java I can do:
HashMap x= new HashMap();
x.containsKey("test"); // returns true/false

Is this the correct way in AS3?
var xictionary = new Dictionary();
x["test"] == null

If so, what happens if someone does:
x["test"] = null;

Thanks

View Replies !    View Related
Is This A Dictionary Bug?
I have an object with a dictionary member. The dictionary holds weak references to objects which have members added to the display list.

After running for awhile the objects stored in the dictionary are garbage collected, even though the objects have members added to the display list which arent garbage collected.

I realize i have weak references set for thed dictionary but should that happen?

View Replies !    View Related
As 3 Dictionary?
any one know if there is an As3 dictionary? Something like this?

http://www.adobe.com/support/flash/a...pt_dictionary/

or something simiar

View Replies !    View Related
Dictionary Bug?
i think there is a bug in the weakly-referenced Dictionary implementation; can someone tell me if i'm missing something?


ActionScript Code:
package {
    import flash.display.Sprite;
 
    public class DictTest extends Sprite {
        public function DictTest() {
            this.testWeakDict();
        }
       
        private function testWeakDict () :void {
            var dictImp:DictionaryImplementer = new DictionaryImplementer();
            dictImp.storeFunc(this.testWeakDict);
            trace("retrieving:"+dictImp.getFuncVal(this.testWeakDict)); //output: undefined
        }
    }
}
 
 
import flash.utils.Dictionary;
 
class DictionaryImplementer {
    private var dict:Dictionary;
    public function DictionaryImplementer () {
        this.dict = new Dictionary(true);
    }
   
    public function storeFunc (func:Function) :void {
        this.dict[func] = true;
        trace("just stored:"+this.dict[func]);  //output: true
    }
   
    public function getFuncVal (func:Function) :* {
        return this.dict[func];
    }
}


i'm using a class member method (testWeakDict) as a key in a weakly-referenced Dictionary (stored in another class instance). it's a member method of the application class, so the method is *obviously* never going out of scope. therefore it should remain in the Dictionary object.

however, as evidenced by the getFuncVal call, the testWeakDict key is removed from the Dictionary.

i was going to post this on LiveDocs, but...there's no Add Comment button on the Dictionary doc page!! ugh.

View Replies !    View Related
3D Co-ordinates Puzzle
HI Everyone
back again... this seemed to be unanswered last week, so just in the hope of getting an answer this time ;o)

i have a 3d problem thats had me stumped for months and i really need to get this bit sorted out so any help would be really appreciated,,i have tried every tutorial i can find but none seem to be as straightforward as i need
anyway


i have some points

camerapositionX
camerapositionY
camerapositionZ

and

camerafocusX
camerafocusY
camerafocusZ

(general x,y,z coordiantes to a normal flash movie, im trying to use the camera focus part as the perspective point so i can move it around

now i have a layer with x,y,z values
eg:

clipX
clipY
clipZ

so in essence im looking for something to stick in a call or function type thing where the inputs would be

inputclipX
inputclipY
inputclipZ

and outputs would be
outputX
outputY

to then 'fake' the 3d coordinates relative to the camera coordinates..
i hope that makes sense ?
many thanks again
Shane

View Replies !    View Related
LoadMovie To Co-ordinates
Anyone know if there is / or how to load a movie into a specific X and Y co-ordinate. I know how to use the loadMovie action but could do with being able to load into a particular place. Just wondered whether this could be done.

Thanx in advance

g2

View Replies !    View Related
Finding Co-ordinates
Hello all,

I'm trying to make a trail of smoke clouds clips come out the back of a rocketship clip that follows the mouse around (the rocket rotates to point towards the mouse cursor and it has inertia etc.).

When I duplicate a smoke clip I want to set its x & y property relative to the back of my rocket clip, whichever way its pointing or wherever it is on the screen.

I've tried creating a small clip inside my rocket clip, at the back, and referencing the _x and _y of this clip when setting the duplicated cloud clip's properties. But it doesn't work!

Does anyone know how I can find the absolute coordinates of this clip inside the rocket clip or is there a different way I should be doing this. Hope this all makes sense, I'm really stuck and would appreciate any suggestions.

dgates

View Replies !    View Related
Getting Line Co-ordinates
Hi all,
Lets say i have a simple line drawing on frame one, how do i get the line co-ordinates of this drawing.
I want to get this info so i can pass it as a variable to PHP and do some stuff with it, namely using ming and GD then saving it as jpeg.
I know how to do all that, just not sure how to get the line co-ords via actionscript.
Cheers,
Suzy

View Replies !    View Related
Stage Co-ordinates
Is there any way of changing the positioning to the stage X and Y co-ordinates using AS?

View Replies !    View Related
Getting Global Co-ordinates For MC
Hi,

I need help to get Global coordinates of a MC to align it.
Suppose I have this structure:

Main MC1//
MC 1
MC 2

Main MC2//
MC 1
MC 2


I have problem to align MC 1 in Main MC1 and Main MC2, .

View Replies !    View Related
Getting The Distance Between Two Co-ordinates
I have two co-ordinates right, an x and y position and then I have another one.
I'm drawing a line between the two and I want to know how long that line is,
I can get the angle between the two eg.

Code:
angle = Math.atan2(yPos2-yPos1,xPos2-xPos1)*180/Math.PI;
but how do I get the length between the two?

Can anyone help?

View Replies !    View Related
Hit Test By Co-ordinates?
Hi,

There is probably a very obvious answer to this that unfortunately escapes me at the moment.

I need to perform a hit test between a movie clip and an area of the stage. For reasons that don't really matter I can't use another movieclip. Is it possible to define a hit area by co-ordinates and width and height in actionscript?

Thanks.

View Replies !    View Related
A Button Using Co-ordinates?
Hi,

I'm stuck

Imagine a menu system where a button is draggable, as you drag it around it doesn't do anything until it it reaches a specific co-ordinate. Then when it crosses it, it loads an external movie.

O.k

There are rules though, the button needs to be able to have more than one set of co-ordinates, which are not single points but stretch across the movie (horizontal and vertical) , this is so it can load more than one external movie. Its basically a navigation.

here's a pic to help you to visualise : -

idea

Any ideas on how I can achieve this?

thanks pixelmisfit

View Replies !    View Related
Complex Co-ordinates
Hi there

I'm new to flash but have a complex problem to solve. Have been given the task in work to work out how to plot lines from a given set of data. Basically it would be a Cardiotocogram being played out on the flash document.

I know this can be done from what I have researched so far but how is a different matter!

Can anyone please help or direct me to some tutorial in complex APi Drawing etc

Thanks Steph

View Replies !    View Related
A Button Using Co-ordinates?
Hi,

I'm stuck

Imagine a menu system where a button is draggable, as you drag it around it doesn't do anything until it it reaches a specific co-ordinate. Then when it crosses it, it loads an external movie.

O.k

There are rules though, the button needs to be able to have more than one set of co-ordinates, which are not single points but stretch across the movie (horizontal and vertical) , this is so it can load more than one external movie. Its basically a navigation.

here's a pic to help you to visualise : -

idea

Any ideas on how I can achieve this?

thanks pixelmisfit

View Replies !    View Related
Problem With Co-ordinates
Hi !,

This is a situation in my application.

There are two movie clips A and B and B has two movie clips inside C and D. B ismoving(not static). A is static. I have to drag A on to B (so that it exactly fits at the center of C) but how can I do it? how can I map the co-ordinates of C to that of A? (coz, I can't use the co-ordinates of C, they are different from A's co-ordinates).

Please help !!

thanks,
rap

View Replies !    View Related
LoadMovie _x _y Co-ordinates
Hi everyone,

I have an empty movieclip on stage - abs_loader_mc - and I want to load some jpegs dynamically into it.

I need to center it on the stage by inserting the code: Code:

Thumb1_mc.onRelease = function() {
abs_loader_mc.loadMovie("path");
abs_loader_mc._x = (Stage.width/2)-(abs_loader_mc._width/w); // this should find the _x center of the loaded jpg
}


The problem is that it's centering the small circle (empty movie clip) in the center and not the actual image. Shouldn't the _width be that of the image?

If I click once on the thumbnail the image loads where the empty_mc is on Stage (before centering) then if I click again it sort of "refreshes" and snap to center position where I want it.

I can do this with an onEnterFrame or setInterval but they are CPU intensive, right? Besides I can get to delete on EnterFrame or clearInterval properly - I'm not really sure where to put either statement so on tracing I know that either they delete before it executes or they don't delete at all.

Any help would be greatly appreciated!

Thanks!

View Replies !    View Related
Dictionary Class
Has anyone implemented a Dictionary Class like the one in Java or Smalltalk and is willing to share their code?

Or, is there a code repository anywhere that might have one already?

Thanks.

View Replies !    View Related
Anyone Has Actionscript Dictionary?
hey, ya'all

i just realised my dictionary was gone when my HD crashed recently, and i haven't been able to find the source where i can download it again. not on macromedia's site even. if you have a copy, will you let me have it, please? or point me to where i can d/l it? thank you.

View Replies !    View Related
PageMaker Dictionary
Hello,

I have a german vision of PageMake 7.0.

Could someone say me if I could install additionaly an englisch dictionary?

If yes - where could I download the englisch dictionary?

Please answer me.....

chris

View Replies !    View Related
Actioscript Dictionary
Hello everybody!!!

Anyone knoks where can I find a complete ActionScript dictionary? if it's posible I need it with diferent lenguages, betwen them in spanish, jejej

Cheers...

View Replies !    View Related
MX 2004 AS2 Dictionary
Hi,

I am getting into AS2 but to code correctly I need to know the syntax. Is there a dictionary inside the help file or somewhere for AS2?

Thanks.

View Replies !    View Related
Anctionscript Dictionary
Can someone tell me where ther's an official flash actionscrip dictionary?? Ive been on one before, but I can't remember where.........

View Replies !    View Related
Dictionary In Flash
Here's a wee problem for you guys/ girls. Im making a countdown game in flash (being the TV show where they ahve to make words out of random letters, with carol vordeman and richard whitley) Anyway, i have most of the stuff done but i need to make it so that the word the user inputed is searched for in a dictionary, does anyone either have an xml dictionary that i could use or is there anyway of using the microsoft word dictionary in flash? Thanks!

View Replies !    View Related
I Need Dictionary In Flash.
i am working for a project, which could possible require the functionality of a dictionary in flash.
to get an idea of what i mean. go to http://www.m-w.com/ and type in any word. and it should return the result .
For Example if i type in :- animation
it should provide me the same result;
Pronunciation: "a-n&-'mA-sh&n
Function: noun
Defination:a motion picture made by photographing successive positions of inanimate objects (as puppets or mechanical parts)

but, i need all this within flash.
as i understand it, the scripting in this would be fairly simple, however the databases is the problem. any suggestions ?

View Replies !    View Related
Is The AS Dictionary Available On Website?
I want to use the AS dictionary that is available from help/actionscript dictionary as a web link, is there such a link

I am using Flash professional 2004

View Replies !    View Related
Code Dictionary Please
WHat does...

} else {

mean ?

thankyou!

View Replies !    View Related
Can I Have A Little Help With Dictionary WeakKeys?
I'm new to AS3 and trying to understand Dictionaries and weakKeys. I've written the following short program which I expected to showcase the garbage collection feature:


Quote:




If the only reference to an object is in the specified Dictionary object, the key is eligible for garbage collection and is removed from the table when the object is collected.





ActionScript Code:
public function Main():void {
    var dict:Dictionary = new Dictionary(true);
    dumpSpriteDict("dictionary created", dict);
    var o:Object = {s: new Sprite()};
    dict[o.s] = 1;
    dumpSpriteDict("sprite added to dictionary", dict);
    o = null;
    dumpSpriteDict("sprite destroyed?", dict);
}
private function dumpSpriteDict(status:String, dict:Dictionary):void {
    trace(status);
    for ( var key:* in dict ) {
        var line:String = "  ";
        line += key;
        var spr:Sprite = key as Sprite;
        line += " (.visible = " + spr.visible + ")";   
        trace(line);
    }
}


Code:
dictionary created
sprite added to dictionary
[object Sprite] (.visible = true)
sprite destroyed?
[object Sprite] (.visible = true)
I really wasn't expecting that last line of output! I thought the Dictionary would be empty after nulling out my Object. Can someone explain my misunderstanding?

View Replies !    View Related
Making A Dictionary
Hi Friends ..
My name is Jawed and i am facing a problem which you can easily sovlve.
The problem is this that i want to make a dictionary of my language
(which is not supported by word or other computer programs)So i am using
picture of the meaning in the dictinary .
suppose i have 100 words of which meaning i want to give with a button.
i have a varible input (text).
a dynamic text field which shows 100 words.
a result text which shows the result of input text.
When i press the but go/search The action script searches the data
of (100 words and if the word matches input it goes to the frame number
wher the actual meaning og htat word is in a picture form and the program
updates itself .
Please help me in this regard so that i will achieve my goal to make adictionary

Thanks
Jawed Akhter

View Replies !    View Related
Actionscript Dictionary
I had wit i thought was a cunning idea the words kirupa used was intriguing but hey to make a dictionary of actionscript but put together actionscript like full loaders etc for people who aint very good at it (like me) And i was wondering any of u flash happy guys wanna send me some actionscript for it and ill add it in obviously ull get credit. And please put a Comment from you on the code if there are any special things to use it

cheers

-Tom

View Replies !    View Related
Loading Dictionary
I was wondering if there was a dictionary.txt file somewhere on the net that contains all the words without the definitons, and that you could load using AS into an array for example and use for games that involve word manipulation.

Any other suggestion for this kind of word games would be appreciated too!

Thanks guys.

View Replies !    View Related
Mini Dictionary
Hi, I hope I am posting in the correct place. Apologies if I haven't.

I was playing around with this tutorial for loading external text: http://www.kirupa.com/developer/mx/m...ynamictext.htm

How would you get flash to load external text from a text prompt rather than a button click ? For example you could type in "Samurai" and it will load samurai.txt or whatever text files you wanted. I am a complete beginner at action script. Can anyone point me in the right direction ?

I want to build a small and simple database of specialist terms.

View Replies !    View Related
Dictionary Class For AS2?
I know AS3 has a Dictionary object in Flash.utils.
http://livedocs.adobe.com/flex/2/lan...ictionary.html

Can anyone direct me to an equivalent class for AS2 code?

Even better, has anyone made an equivalent set of classes for other standard containers, such as a linked-list hash, etc...?

Cheers.

View Replies !    View Related
Loading Dictionary
I was wondering if there was a dictionary.txt file somewhere on the net that contains all the words without the definitons, and that you could load using AS into an array for example and use for games that involve word manipulation.

Any other suggestion for this kind of word games would be appreciated too!

Thanks guys.

View Replies !    View Related
Actionscript 1.0 Dictionary?
I just downloaded Flash 8's demo and can't find the AS 1.0 dictionary anywhere in the help files... Is it still there?

View Replies !    View Related
Actionscript Dictionary
i know this actionscript stuff is complicated, and i must admit that I am a newbie. But does anyone know of any sistes that just offer a huge dictionary of actionscript? I mean im looking at some of the scripts that some users are posting and they don't seem as complex as I use to think, if I knew what things did then I'd probably be able to get the hang of things. So if anyone can help Id appreciate it.

View Replies !    View Related
Dictionary.length?
Anyone know best practice for retrieving the number of objects held in a dictionary object?

Since there isn't a length property, or getLength method, I'm assuming that you can only loop through the dictionary, and use a counter variable.

yay or nay?

View Replies !    View Related
Changing Starting Co-ordinates
I have downloaded an image scroller from the fla. section however the scripting is based on the starting co-ordinates been 0.0, 0.0. I want the starting co-ordinates to be 25.0, 25.0 the problem is I am not to sure where to make the amendments. Any help would be greatly received as it's driving me crazy.

// variable for the image instance path (symbol: reef_graphic, instance: img)
varimg = _root.img;
// variable for the background instance path (symbol: background, instance: bgd)
varbgd = _root.bgd;
// speed of the mouse scroll (between 0 and 1)
v = 0.1;
// mouse position
mousex = varbgd._xmouse;
mousey = varbgd._ymouse;
// image position
imgx = getProperty(varimg, _x);
imgy = getProperty(varimg, _y);
// distance fom the center to the left, right, top and bottom side
left = getProperty(varimg, _width)/2;
right = (getProperty(varimg, _width)/(-2))+(getProperty(varbgd, _width));
top = getProperty(varimg, _height)/2;
bottom = (getProperty(varimg, _height)/(-2))+(getProperty(varbgd, _height));
// scrolling of the image
setProperty (varimg, _x, (imgx+(mousex*v)));
setProperty (varimg, _y, (imgy+(mousey*v)));
// stop the image on the horizontal side
// left
if (getProperty(varimg, _x)>=left) {
if (mousex>0) {
mousex = 0;
setProperty (varimg, _x, left);
} else if (mousex<0) {
mousex = varbgd._xmouse;
setProperty (varimg, _x, (imgx+(mousex*v)));
}
}
// right
if (getProperty(varimg, _x)<=right) {
if (mousex<0) {
mousex = 0;
setProperty (varimg, _x, right);
} else if (mousex>0) {
mousex = varbgd._xmouse;
setProperty (varimg, _x, (imgx+(mousex*v)));
}
}
// stop the image on the vertical side
// top
if (getProperty(varimg, _y)>=top) {
if (mousey>0) {
mousey = 0;
setProperty (varimg, _y, top);
} else if (mousey<0) {
mousey = varbgd._ymouse;
setProperty (varimg, _y, (imgy+(mousey*v)));
}
}
// bottom
if (getProperty(varimg, _y)<=bottom) {
if (mousey<0) {
mousey = 0;
setProperty (varimg, _y, bottom);
} else if (mousey>0) {
mousey = varbgd._ymouse;
setProperty (varimg, _y, (imgy+(mousey*v)));
}
}

View Replies !    View Related
Drawing A Line From One X & Y Co-ordinates To Other X & Y ...
Hi

Here's my Question ..
Is it possible to draw a line from one x & y co-ordinates to an
another x & y In Flash 5 ..?
I need to do it for more than 3 to 10 points ( x and y's)

If yes how do I do it ? I need the code as my very poor at AS..
Can anybody help me .....

kEep It FlAsHiNg..
FlashPRASHI

View Replies !    View Related
Loading A Movie Into Certain Co-ordinates
On mouse-over i want my menu to appear, is it possible to say where exactly i want the menu to appear cos at the moment its covering up my titles!

View Replies !    View Related
Finding Co-ordinates Problem
Hello all,

I'm trying to make a trail of smoke clouds clips come out the back of a rocketship clip that follows the mouse around (the rocket rotates to point towards the mouse cursor and it has inertia etc.).

When I duplicate a smoke clip I want to set its x & y property relative to the back of my rocket clip, whichever way its pointing or wherever it is on the screen.

I've tried creating a small clip inside my rocket clip, at the back, and referencing the _x and _y of this clip when setting the duplicated cloud clip's properties. But it doesn't work!

Does anyone know how I can find the absolute coordinates of this clip inside the rocket clip or is there a different way I should be doing this. Hope this all makes sense, I'm really stuck and would appreciate any suggestions.

dgates

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved