ActionScript 3.0 :: Can't Get Position Of Dynamically Positioned Sprites
Jul 15, 2009
I have an as class file that places some sprites at various positions around the stage, what I would like to then do is add event listeners to these sprites and do something starting from the x/y of that sprite (not the mouse x/y).
I'm populating an array with the created sprites and later looping through and assigning the event handler to the sprites but I can't seem to get any thing of any use out of them.
I'm calling the following function in a loop, each time I'm adding the returned point to an array (pointsArray) and then calling addChild.[code]...
For the life of me I just can't figure out a syntax to make button1thumbs.swf load into that movie clip, and I've tried all I can think of, but it's probably something dumb on my part.
Basically I redraw a circular object ("moon") every frame, reposition it and rotate it. I want a gradient fill that's offset to the left (-x) by the circle's radius. Instead of wasting your time talking about what I think it might be, I'll just show you the code . . .
For simplicity's sake, I've changed the colors to blue, red, green (in that order). Only the last one's showing up. I've tweaked the vales in the matrix itself for hours, but I can't really change anything. I can get the gradient fill to center on the circle, but that's the best I've done so far . . .
ActionScript Code: var centerX = Stage.width/2; var centerY = Stage.height/2; var radX = 210;
import flash.display.Sprite; import flash.net.URLLoader; var index:int = 0;[code].......
I am relatively new to flash and action script as well and I am having a problem getting the sprite to be removed after another is called.I am making emission spectrum's of 3 elements by dynamically generating the mask over a picture on the stage. Everything works perfectly fine with the code I have right now except the sprites stack on top of each other and I end up with bold lines all over my picture instead of a new set of lines each time i press a button.I have tried using try/catch to remove the sprites and I have also rearranged the entire code from what is seen here to make 3 seperate entities (hoping I could remove them if they were seperate variables) instead of 2 functions that handle the whole process.
how to add a keyline/border to dynamically generated sprites?
i have some script that creates a video wall effect - but i am wanting to add a white/defined col border to each of the sprites.
i've tried a couple of snippets that i have found around the net - but nothing seems to do it - either errors or does nothing. here is the script that creates the thumbnails
i am trying to do the following: in a tile-based game i want to attach a bunch of tiles which are movieclips the tiles are all similar in function, only the graphics are different. so i created one basic class for all of them:
Code: package { import flash.display.MovieClip; public class TileMC extends MovieClip {
I have a dynamic text field that loads a variable into it (just a simple text file). This text file will be updated on occasion. I also have a movie clip to be positioned below the text field, however I want the movie clip to change position depending on how much text is in the text field so there isnt a large gap and so they dont overlap. Is this possible? I tried the following actionscript to adjust the size of the text field depending on the amount of text. textField2.autosize = "center"; However I have no idea how to get the y position of the movie clip to adjust accordingly.
I'm using a used code of a slideshow. I figured everything except how to place the slideshow in the center of the div popup tag. This is the actionscript 2.I managed to move the pictures in the center where it says:[code]
I am trying to change the depth of MCs that are already positioned on the stage. However, there doesn't seem to be a property such as _depth. So can I even change the depth of an MC during the game and if so how would I do it?
So, it is possible to import a psd file to flash and have it all positioned correctly, if the PSD file is set to "Maximize PSD File Compability", however, the files(layers) does not appear in the XFL save in the LIBRARY folder, and the alpha and quality is horrific probably because the layer is taken from the composite layer, and not the real layer in PSDok, no need to worry yet, all we want is the correct position, that would save a lot of time, lets export the file from photoshop with the script, "export layers to file", then import the files in flash to the files we already imported and replace them in the flash library, Now this is where the problem arise, the file in the library, has some 'special treatment' done to it, and it is still not saved in the LIBRARY folder in the XFL save. When the high quality file replaces the trashy library item, the file disappears and probably gets saved in the bin folder as a
I am trying to change the depth of MCs that are already positioned on the stage. However, there doesn't seem to be a property such as _depth. So can I even change the depth of an MC during the game and if so how would I do it?
I have a 1200 px wide scrolling menu movie clip which is placed on a stage that is 650 px wide (mc menu is approx 2X wider than the movie). It is aligned left to the stage and whenever a user moves the cursor over it - it scrolls itself around _x axis (inverted x axis). Here is the code that works:
ActionScript Code: onClipEvent (enterFrame) { if (this.hitTest(_root._xmouse, _root._ymouse, true)) { //take mouse position and invert it
[Code].....
But sometimes during aggressive mouse movement over the menu mc, the mouse position variable goes beyond it's limits (I don't know why, latency error?) by 20-30 px. This makes the menu go way beyond its limits/bounding box and almost completely exits the screen.
I've tried adding mc that registers the movie area, limiting _x axis in the IF statement, but whatever script I make it either: glitches, doesn't move or just goes all over the place.
How can I make the menu mc move only in specified movie area?
I'm trying to create 49 total objects, each 50x50 px. And position them in 7 rows and 7 columns. I think I must use nested for loops but this is all Ive come up with.
I was just wondering if this is possible, and if anyone knows how it could be done
What i intend to do is have a number of movie clips which load a photo from XML.As well as the photo i want something in the XML code that tells the movie clip where to place itself on the scene. For example it could contain a number from 1-8 and the scene will be split into eight sections across the X axis. So if it has the number 3 it will go in the 3rd section across anywhere on the Y axis.
I'm trying to create a dynamically generated navigation submenus. Basically I'm creating instances of a MC using attachMovie, I'm populating it's text field sizing it's background image's width (subGlow_mc) based on the width of it's text field(link_txt). I get the movies on the stage but hey dont position how I would like them and the backgound images are not resizing consistantly. I have pasted the AS that loops through the flash remoting call to generate the movies below.
[URL]
function createSubMenus() { ////Setting the intial X and Y coordinates. var initX = 800;
I have created a small flash move 40px x 40px and placed a movieclip in the centre of the stage. When I publish the file it positions the movieclip to the right of the published window. When I trace the movieclips x and y the movieclip position is correct. It almost looks like there is some sort of margin around it. Flash CS5
i have a class that creates circles randomly placed at stage, i want then to move those circles and make them bounce off the stage, i know how to do that, the problem is that when i add a new shape into my stage, that shape, has an "x" value of 0, no matter where it appears, how can i check the real "x" value of that shape within the stage, so i can continue with the bouncing check...
so i just want to know the "real" "x" and "y" positions of my Shape attached to stage to attach a ball to stage i use the createBall method called from my fla....
I have a flash project where different movie clips are loaded dynamically according to the data retrieved from an XML file. And they are positioned one after the other as if they were in a menu. Inside those movieclips there is a button that when it's triggered unloads the movieclip so it disappears from the menu/list. Apart from that, I would like the rest of the attached movie clips to tween and move upwards, so the list keeps its form. I'm finding quite difficult figuring out this function. I'm copying the code I'm using :
I'm trying to get a dynamically loaded swf to load into an empty mc behind a particular mc on the stage. I used actionscript to create an empty movie clip using the createEmptyMovieClip command. But, how can i get it to create it, then load the external .swf into it behind a exsisting mc on the stage?
I was wondering how "relative alignment" such as on the easybit-site (take the window and resize it) is done? All objects on the stage are positioned always relative to the actual window-size without losing quality, but how???
I am trying to populate a movie clip with buttons positioned by an xml file and have info windows pop up when you hover over these with images text and links in the info window which needs to resize based on the amount of content in it, also from the xml file. Almost like google maps. (as2)
I'd like to make sort of gallery with previous/next buttons. And on each image you'd have circles/link over important parts of the image.So each image wold have these circles on different locations. Question: how can I make that dynamically? And that it's not to complicated for the editor of the site? One way would be to write in XML x and y positions.
I've got a movieclip with two layers - a background movieclip, and above that, a mask movieclip (as you might guess, this layer is masking the first). Due to design necessity, the mask is animated on the timeline across 60 frames.The problem arises when I use an Event.RESIZE listener to change the width of the parent movieclip when the browser window is resized. Any code to reference the mask, i.e
Does anyone know the code for finding the global positioning of X & Y co-ordinates of a click of a button which is constantly rotating, and then secondly the code for when you click on the button it displays a movie clip on top of it -(position of x & y when clicked) at the angle that you clicked it,so underneath the buttons are still rotating so other people can click them where they are?
to explain the context, I'm trying to design a mock up of a circular interactive table Dynamically placing movie clip at the angle and global position of a mouse click (button) which is constantly rotating.when someone comes up to it and clicks on one of the buttons that are moving, it reads where the person clicked it and opens up a new box (movie clip) where they clicked it (at the angle) so its not upside down if you are at the top.
I've included my .fla file which shows the four buttons moving and a little diagram explaining what I'm trying to do.
Does anyone know the code for finding the global positioning of X & Y co-ordinates of a click of a button which is constantly rotating, and then secondly the code for when you click on the button it displays a movie clip on top of it -(position of x & y when clicked) at the angle that you clicked it, so underneath the buttons are still rotating so other people can click them where they are?
I'm trying to design a mock up of a circular interactive table when someone comes up to it and clicks on one of the buttons that are moving, it reads where the person clicked it and opens up a new box (movie clip) where they clicked it (at the angle) so its not upside down if you are at the top.
I've included my .fla file which shows the four buttons moving and a little diagram explaining what I'm trying to do.