ActionScript 3.0 :: Placing Objects - How To Ensure MCs Do Not Overlap / Pile Up
Aug 16, 2011
I have all the functionality that I want. The basic premise of this exercise is that youth will grab a statement, drag over a microphone and it'll appear on the corresponding area (board1, board2, board3). So if they grab two statements in a row it'll place their answers at my predetermined spot. Is there a way to space each answer by a difference of 10 px? So they grab answer one and it'll go at (x) 75px, answer two will go to (x) 85 px? Basically ensuring that the mc's will not overlap or pile up.
Not sure how best to put this into words Ddoes the depth manager always keep one on top of another, or can planes intersect, overlap, go through one another?
I ran into an odd problem a week ago that I haven't been able to fix. I'm new to Flash so sorry if this has been discussed but my research has turned up nothing. I'm using Flash Develop. I managed to duplicate the problem in a simple program: I set up one large bitmap for the background, not transparent. I then add another large bitmap on top of that, the second layer background, as a child of the main bg. This layer has transparency so you can see the bg through the trees and such. Then I stack a lot of sprites on top of each other, all with transparency. They can be children of the main bg or the second layer bg, doesn't matter. Where the transparency of the sprites overlap the second layer background disappears completely to reveal the main background (like a window around the sprite stack.) The bitmaps I'm using are from embedded png files.
I found that 23 transparent objects causes the 24th object and beyond to disappear. And it only happens when I have a mask set to the main background (a simple filled square for clipping the child sprites that move off-screen.) Also the problem goes away while the background is moving. My project features many objects near each other so the chance of this problem occurring is pretty high. Its not game-breaking but I'm new to flash and my project is nearly complete (and large) so I'm hoping there is something simple I can do to fix this.
I have played some more with Flash and come upon something that i would know more about.I tried to make:A scene. when I click the left mouse button on the stage an object(from the librery [graphic]) will be place exactly where the mouse is.I did not really know how to approach this, but tried anyways.
This is my code:
stage.addEventListener(MouseEvent.MOUSE_DOWN, addApple); Function addApple(event:MouseEvent):void{ //I dont know what to put here to place an object(apple) from the libery //onto the stage where the mouse is. };
i am makeing a poker type game. and i have come a lil stuck. i have 8 players around a table. i have a player class that creates a new player when a button is pressed. the prob is io can get all the players cards x & y pos in lines like on the same x or same y axis. but how would i make the cards deal around a table. would i have to work them out and write x & ys for each player or is there another way?
I'm loading a external SWF in to my FLAs cats_mc movie clip. How can I make the imported SWF appear underneath of the current objects in my cats_mc movie clip?.
I am trying to place an array of objects onto a stage where they drop vertically. I have been able to do it by placing the array objects into an object called "bag" but have found that the bag object only contains the last array object id so I can not apply actions to various array objects. Also my objects do not loop and only appear once.
Below is the code so far.
var tempArray:Array = new Array(); // Stores randomised values var bagArray:Array = new Array("gslow_id","gshigh_id","glow_id","ghigh_id","gdiv_id",
In my current project I'm building a waterfall. Each drop in the waterfall is generated from the waterfall.as class and added to the stage via addchild. Now I have a mask that I want all of those drops to use however I can't seem to get this to work. I've tried placing the mask on the timeline and I couldn't seem to access the mask from the waterfall.as file. I've also given the mask it's own class and added it dynamically to no avail.
Does one normally use some sort of wrapper object to do so?
For example, if I have an array with 10 elements (for example, images that are gonna be linked), I can loop through the array and add them to stage with:
myArray[i].x = i * myArrayElement.width;
What if I wanted to position all of the elements yet keep them in the same positions relative to each other.
Can you do so with an array, I gather the answer is no. So if that's right, do people throw an Array into another object and the use that objects x property?
I'm animating a torn sack that will deflate as the beans inside of it spill out and pile on the ground. The sack I'm animating frame-by-frame, so the problem is the beans-- I can't imagine animating them one by one, but I know nothing about actionscript and the few tutorials I've found online don't address what I need to do; worse, they seem hopelessly complex.
In AS3, changing the childIndex of one movieclip ( say from a list of 10 movieclips), may change the childIndex of some another movieclip ( Flash probably does it to prevent outOfIndex error ) It sometimes become a headache to manage and code them, as movieclips show above each other in an unexpected manner.Is their any inbuilt way to make movieclip stick with a particular childIndex ? ( In AS2 there were depths that kept constant from 0-9999. And it was a real breeze as compared to AS3.0)
I discovered _visible. What I can now do is pile everything onther same frame and change the _visible of items when I want them to show. Before, I used to have different items on different frames. And I would move to the frame when I wanted an item to show. Method one is a little bit harder, but once you've done it a couple of times, it becomes easy. And I find it easier and quciker to develop once mastered. The second way, well I kind of thought: maybe this is less processor intensive? Movies are only brought onto screen when they need to appear. Is this true??
My movie publishes fine in FP9. When I try to publish in FP10 (so I can use unloadAndStop() ) I get a pile of 1009 errors and many of my Tweenlite instances won't work. Is there something obvious I'm missing here? Are there big differences between FP10 and 9?
I had created a flash which load several images and display it using loadMovieClip(). I need the images to load in a specific order according to the information retrieve from a xml file. However, my scripts only works well if it was tested in my local computer. In online environment, the images seems to load in a random sequence. so that the images loads according to the xml order?
Below is my scripts:
var myShowXML = new XML(); myShowXML.ignoreWhite = true; myShowXML.load("galleryxml.xml");
So i have several SWFs in this project and i need to find a way to ensure that only a single instance of one of these SWFs can load. For example, you cannot open 2 different application SWFs in 2 different browsers, or tabs on the same computer at the same time. LocalConnection seemed to be the best solution to this problem, however, we are experiencing problems with Internet Explorer 9.
Few users of my Flex 4.6 web application are complaining, that the mx.controls.PopUpButton at the right bottom corner of it sometimes opens a List underneath it and is thus unusable (I can't reproduce that myself - probably an unlucky combination of their Flash player and/or font size setting?)
How could I ensure, that the popUp component (in my case it is a spark.components.List) always opens above the PopUpButton?
I suspect, that I should create a skin based on mx.skins.halo.PopUpButtonSkin and assign it to my PopUpButton? And I probably should use the PopUpPosition.ABOVE constant together with the PopUpAnchor?
I have prepared a screenshot and a simple Text.mxml:
I still can't reproduce the bug myself, my users aren't very helpful (mostly older folks, playing my card game). I've searched in Adobe JIRA, but couldn't find such a bug.
I wonder, if there is a way to short-circuit that method to enforce opening the popUp above the PopUpButton.
Or if I should put the _list into some container...
I'm working with some images using the tween to move them. Sometimes the tween seems to stop and quit towards the end (sometimes its fine) Is there a way to check and ensure the tween is going from from start to finish
Since there is no way that you can make the flash object transparent, there needs to be some other means by which you can match the background. I thought of maybe creating a ActionScript/Javascript bridge, but I wonder if this is the route to take.
When code changes for allItems the item disapears from screen as expected but still sits in memory! I know this by a function inside a compoenent that has "trace" so the trace output still displays even after the component disappears from screen. How do I ensure that the element is deleted when it's reference is deleted? Will using List-based component to display items instead of "Repeator" solve the problem (it requires significant refactoring of my code so I'm asking before trying it out)
However when doing so it then has to load this sound file even before the preloader can display. One work around I've used before is to make a swf that just loads the entire second swf. This ensures that everything will be loaded at the start.However, if possible I would like to avoid this. I know that if i place the sounds on the stage (after frame 1) the preloader works fine, but at that point Im unsure how to access them within my as3 files.So if anyone knows how to ensure the sounds do not get loaded before the preloader starts and I am still able to control them via actionscript.
I'm building an app that is interfacing with a database through PHP, but it looks like it's grabbing a chached version of the php page, which is giving it old data. How do I ensure that Flash loads the file fresh from the server and not from cache? I'm using URLLoader, andI've tried putting the question mark at the end of the URL (i.e. "questions_view.php?").
I am creating a flash-based Kiosk. When launched, it runs full page/full screen.
However, if a user clicks a button that opens an external document, the swf or Flash Projector exe leaves full page mode and appears in the Flash Player.
Is there any way to ensure the swf or projector file always stays in full screen - full page mode
i've made some buttons that on mouseover shows a larger picture above the button. when the cursor leaves that button though the picture disappears until the user mouses over the button again. is there a way to ensure that the picture stays up until the user mouses over another button (then they would see another image)?
I am using an component, and currently have a dataProvider working that is an ArrayCollection (have a separate question about how to make this an XML file... but I digress). Variable declaration looks like this: