AS3 :: Function To Arrange Depths Based On Z Position & RotationX
Apr 17, 2011
Any smart people out there who can tell me why this function Im working on to automatically sort the depths of objects placed on the 3D plane is only working intermittently? It seems to work every second or third iteration?[code]Is getChildAt(i) reliable? IE does it return the same order each time it runs or is it based on depth? looking at the manual suggests that it's probably the latter so I guess I'll need to make my own array ordered by the time the sprites were added to the parent and work from there. Is there a better way?
View 1 Replies
Similar Posts:
Oct 23, 2010
In my code I am creating MCs and having them drop down the screen at varying speeds, but am having a hard time thinking of an easy way so that if one MC 'overtakes' another slower-moving one it will be displayed above it.I really don't want to have to run a hit test every frame for every MC through the array of MCs..
View 3 Replies
Jun 12, 2008
I've been trying to sort objects depths based on their Y position but have not been able to do it efficiently. I was able to successfully sort objects with a selection sort algorithm and a quick sort algorithm; however, both have only been partly successful. Selection sort gets about 8-10/30 FPS with 13 objects and gets about 14-18/30 FPS. This is not good enough as I figure I could have as many as a hundred objects to be sorted at once.
After digging around, I found that array.sort() is more efficient than a quick sort implemented in AS3 and that calling swapChildren() or swapChildrenAt() at every swap was bogging it down. So now I am copying the objects array and sorting it with sort() and then comparing the two and swapping displayObjects so as only to call the swapChildren() or swapChildrenAt() method once per element. It appears to be running, and at full speed, though it won't swap correctly. Here is my code:
[Code]...
View 14 Replies
Jun 4, 2003
I don't know how to arrange the position of the chromeless window. I add the script below. Could you show me where and what I need to write to arrange the position of the window from left and top side.
The window opens almost at the center in my computer but I checked in other computers it opened at the top and work like a fullscreen. I want it control by myself.[cod]e...
View 3 Replies
Jul 20, 2011
So I'm working on my portfolio and I got this problem. The code posted scrolls the sprite "cellContainer" based on the position of stage.mouseY. Perfect.Problem is that I want stage.mouseY to equal the entire cellContainer height. Kind of like how a small tablet equals a huge monitor. So when stage.mouseY = 0,cellContainer.y = 0 and when stage.mouseY = stage.stageHeight, cellContainer.y = stage.stageHeight - cellContainer.height. Right now, it scrolls, but it takes a while to scroll throught the entire height of cellContainer. I want it to be proportional to stage.mouseY.
Actionscript Code:
private function scrollStart(e:Event)[code]....
View 4 Replies
Jan 14, 2010
I am working on a site, that has 5 main pages: the home, and four sub-pages. Essentially, I have an element that slides up over the screen anytime you click "from" the home page to one of the remaining pages. Consequently, when returning to the home page, the element slides away / off the screen.
I am thinking the best way to handle this is with a conditional statement, but not really sure at all how that code would look especially in relation to position. My thinking for the code would be as follows:
[Code]...
View 1 Replies
Jan 3, 2011
I would like to input a certain (x,y) coordinate and have a function return which movie clip is based at that location. Is such a method possible, to refer to a movie clip based on its position rather than instance name?
View 1 Replies
Feb 24, 2012
how to get the X and Y coordinates of a character in a string based on index? I find it odd that I can get the exact letter and index by clicking a character in a text field, but I haven't found anything in code that can get those coordinates without a user click. Seems like they would have to know the x,y of the individual indexs to be able to tell you what letter you're clicking based on your own mouse coordinates.
View 3 Replies
Oct 10, 2010
I'm doing an online advertising format (728x90 leaderboard). I have embedded a video into the flash file which covers 1/3 of the format (242x90).What i need to do is seek this video from 0% to 100% based on the mouse position over this area (242x90). I'm guessing it would be easier if i created a button over the video which is 242x90 but i would still be looking for the code that seeks the video based on the mouse position over the button.
View 7 Replies
Jun 18, 2005
check out: [URL] - great site
Does anyone know how this scrolling based on mouse position works?
View 8 Replies
Jan 10, 2009
I have created a document 600x300 filled with buttons for a rollover effect. I want to be able to play sounds dependant on the x and y position of the mouse without having to use objects that interfere with the buttons.
View 2 Replies
May 25, 2009
I'm trying to make a faux 3D rotation animation where if the user mouses to the right the object rotates right and if the user mouses to the left the object rotates left. Depending on how far they move the mouse the rotation should speed up or slow down.I spent a lot of time making an object in 3d studio max and importing the animation of rotation as JPEGs onto the timeline. I figured the most efficient way to go about this would be to make the mouse control the timeline instead of the object itself.
View 4 Replies
Oct 2, 2009
I have a thumbs_mc with thumbnail images. Within thumbs_mc, I have a transparent overlay_mc that functions as a button. Mouse over the overlay_mc and the alpha chages so there is a tint over that particular thumbnailWhen overlay_mc is clicked, the main timeline goes to a particular frame label.What I need to do is have the position of the playhead on the main timeline also determine the alpha of the overlay_mc so the viewer knows which thumbnail is playing.
View 1 Replies
Mar 26, 2009
I am attempting to create 360 degree spin-around product viewer. So far I have a movie clip with 24 frames, each one with a different 15 degree angle shot of the product. Upon playback of the movie, the product appears 3D, spinning 360 degrees.
That was the easy part. Now what I need is to be able to click and drag the product to change which view you are seeing (or which frame in the mc you are on) thus producing a spinning effect. How can you code, in AS3.0, that when the mouse is clicked and drug, go to a certain frame based on the current X position of the mouse?
View 21 Replies
Mar 19, 2012
Is there a way to get the broad position of a user based on the IP address? (I'm building an Adobe Air desktop app for notebook users)
View 1 Replies
Dec 19, 2005
where i can find a script to attach to a movie/background image so that i can make the movie clip pan left or right based on the mouse position (with easing too!)? Example http:[url].... make sure you enter the site thats where you will see what i mean. I've been wanting to create a page like this for some time using png files and transperency and multiple layers.
View 9 Replies
Aug 19, 2008
i know the pythagorean theorem for figuring out distance between 2 points.
what i don't know is how to take that equation and determine another aspect based on 2 different bits of data.
figure out the ending _y position based on the starting point, the initial angle and the ending _x position??
View 1 Replies
Apr 13, 2009
Code:
package
{
[code].....
View 3 Replies
May 26, 2009
Is it possible to do what this tutorial shows but instead of having your mc�s be positioned related to the stage, have them be positioned related to the browser window?
[URL]
View 2 Replies
Jun 16, 2009
I have am wanting to do a quick calculation based on the mouse position.here is what I am trying to do.I have an item the site on the stage
stage.width = 400;
object.width = 900;
object.x needs to be at its most -900 and at its least -225.
and based on the mouse position on the stage object will scroll within these bounds.I have all the functional done but just need to know the basic equation to find these points.
View 3 Replies
Nov 30, 2009
I have created a globe that rotates with no problem, but what I am trying to do is to control the direction of the rotation based on the mouse position. For example, if the mouse is to the right of the globe, it rotates towards the right and if the mouse in on the left, the globe rotates left. When the mouse is over the globe, it should stop.
View 1 Replies
Apr 12, 2010
I've searched for ages on this and I can't see how it's done, I've got a set of images in my library and each one has been "exported for actionscript" with class names of stim1, stim2...stim12. Now, I have a bit of actionscript code that creates instances of these classes and will load the stimuli to the stage:
[CODE]...
View 1 Replies
Nov 22, 2010
I've got a set of images in my library and each one has been "exported for actionscript" with class names of stim1, stim2...stim12.Now, I have a bit of actionscript code that creates instances of these classes and will load the stimuli to the stage:
Code:
var BitmapDataLeft:stim1 = new stim1(150,150);
var imageLeft:Bitmap = new Bitmap(BitmapDataLeft);
[code]....
View 1 Replies
Jan 20, 2011
I am trying to make an animation where the user can mouse over a small MC at the top of the stage, which controls the movement of another larger MC at the bottom of the stage.I am thinking that 'points' (which I know nothing about) might be the way to go. The other thing is that it needs to be fluid motion. Am I at least on the right track with points and mouse_move or is there a better approach for this?
View 2 Replies
Aug 1, 2011
I use the following code to load some banners: a "banner" is a clickable PNG image. I get the URL it must point to through a parameter of the AdLoader class.
package
{
import flash.display.MovieClip;
import flash.display.Loader;
[Code].....
In practice, I create some MovieClip containers (loader_1, loader_2, etc.) and in each container I want to load one image.
What happens: when the images are loaded I want to position each image at the y+10 pixel of the preceding, so if the first is at y:0 and its height is 140, I want the second image at y:150 (and so on). I can't understand what it happens but sometimes the code works, while most of the time it doesn't.
View 1 Replies
Mar 1, 2012
I'm writing a game with Flash CS5/AS 3.0 that tries to simulate depth of field by drawing all the relevant Movie Clips based on their Y position in ascending order, i.e. things lower on the stage overlap things higher on the stage. A MovieClip with a Y position of 10 would therefore need to have a lower index compared to a MovieClip with a Y position of 20, so the second one gets drawn on top of the first.
I wrote a quick and dirty function just to test this. During the trace, I've noticed that the truck's index hits 0 when I go near the top of the stage, but if I go too far up it will completely disappear from the stage. Trace then starts generating this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/getChildIndex()
at EICT::Game/ReorganizeDisplayIndexes()
[Code].....
View 2 Replies
Aug 11, 2009
I'm creating a slideshow gallery in flash and am basically there now except for one bit...
have a look here [URL]
The slider at the bottom for the thumbnails moves ok but I want it to stop at the last slide. I
I can manage to code it based on the mc's _x value
i.e if (mc._x < -200){ //do nothing }
but this creates a dead stop and I want a gently slow down like if you were to navigate from thumb 8 back to 1.
all of my coding at the moment uses the mc's x value in relation to the mouse's distance.
The code I have currently set on the slider is:
Code:
onClipEvent (enterFrame) {
if((_root.slidesQTY>6)&&(_root._ymouse>460)){
if(this._x<0){
[Code]....
how I could add another if statement that doesn't halt the animation as it hits the last slide but creates a smooth slow down?
View 0 Replies
Dec 5, 2009
I have text that loads into a dynamic text field that is on the stage. The movie clip("tile" in code below) in which the dynamic text field resides is placed on the stage via loop function.I can load the text from the xml file just fine.However, since each text field in loop autosizes, which is what I want, (in height only-width is fixed), I want the next text in the loop to load in a Y position based on the previous text box height including a "cushion" of my choosing. I'm very close, but can't seem to get the math right that is needed for the tiles Y position...
Here it is:
Code:
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("faq.xml"));
xmlLoader.addEventListener(Event.COMPLETE, onXMLLoad, false, 0, true);
[code]....
View 3 Replies
Feb 27, 2010
I have been racking my brain trying to figure this out for some time. I have some animated links that activate based on mouse position. The problem is when you whip the mouse over them quickly and it leaves the dimensions of the project, flash thinks the mouse is still there and the links continue their animation. IT IS EXTREMELY FRUSTRATING!! I have a feeling its a simple fix but i cant figure it out. here is the site - [URL] the actionscript is below...probably the most round about way ever devised.
[CODE].....
View 0 Replies
Feb 11, 2009
I need to move a movieclip based on mouse x position. Like this site [URL] - Which I built using a flashloaded app, but I need more control in this project so I'd like to code it without the app. Basically, I have an image of a boy (left) and a girl (right) and I want to move the boy slightly toward the girl when the mouse goes right and slightly away when the mouse goes left. But only about 25-50 pixels in each direction.
I've cobbled some code together from google searching and rough ideas, and it works in a way, but the boy jumps about 400 pixels to the left on the initial mouse move and then floats a bit too far right and left from there. Here's what I've got on the boyMC:
[Code]...
View 2 Replies