ActionScript 2.0 :: Flash8 Random Without Overlap
Aug 1, 2009
I have a screen showing 6 buttons. 3 of these buttons are fixed controls which must always be in view while the remaining three will be randomly selected for each question from a total of about 150 possibilities (do I really have to make 150 differently labeled buttons? (but this is a side issue)). these randomly selected buttons show up at randomly selected screen positions? I'm vaguely aware that X and Y and random will be used here.
The idea is to prevent the user from becoming familiar with the layout and building an intuition which would be counterproductive to the aim of the application. The remaining aspect of this problem after randomizing the position of the three dynamically generated buttons is that they must not overlap the 3 fixed controls which must be always available. I'm sure II could spend weeks on this without a few good tips to point me in the right direction.
View 2 Replies
Similar Posts:
Apr 23, 2009
I need help with this navigation it appear to overlap every time I highlight the text from the drop down then move my mouse to the right then up. and that's when it overlap all of the drop down.
View 4 Replies
Dec 21, 2007
I have come across a variable scoping issue in Actionscript 2.0 that seems rather odd. I create a Game class that has various types of properties:
class Game
{
public var test_number = new Number;
public var test_array = new Array;
[code]....
I can assign the numeric properties for each object just fine:
g1.test_number = 42;
g2.test_number = 23;
However, when I assign values to the array property:
g1.test_array[ 0 ] = 1;
g2.test_array[ 0 ] = 2;
...for some reason this will assign '2' to both of these values, even though they exist within separate Game objects! What's stranger is that they stay in their own discrete namespaces if I populate the arrays like this:
g1.test_array = [ 1, 2 ];
g2.test_array = [ 3, 4 ];
That works just fine- the overlapping-namespace problem does not occur. However, it does occur with the test_hash as well:
g1.test_hash.some_key = 1;
g2.test_hash.some_key = 2;
This code results in both g1 and g2 winding up with '2' in this value! How can this be? Is this a bug in actionscript?
View 2 Replies
Jan 29, 2009
I like to place lets say 4 movieclips on the stage with a random x-axis, but with no overlap, and if possible also not outside the borders of the stage. Performing the hit test would be not to hard, but then perfomring it again untill it is true, that is the tricky part (for me).
On the other hand I just want to place them visually random on stage, but infact they need to be more or less evenly distributed over the stage width, so maybe another solution is easier?
part of the code:
Code:
else if((i > spacery) && (i <= spacery*2)) {
container.x = Math.floor(Math.random()*800);
if (if (container.hitTestObject(container)){
[code]....
View 2 Replies
Aug 22, 2009
I am working on a flash file that imports xml data. This data gets run through a for loop and each xml child gets its own movieclip called menuItem. Then the various instances of menuItem are randomly placed on the stage. However, they always overlap to some extent. I don't want this.
So, how would I make sure they don't overlap? I looked at the hitTest function but it seems to require 2 different movieclips to check for the collision. I only have one movieclip with multiple instances.
View 10 Replies
Aug 22, 2007
The idea is to load an undefined number (around 200) movieclips (filled with pictures) that are grouped by "family" (probably 30 groups). all this data being retrieved from a mysql database (via AMFPHP).ll of this brings up no problem of any sort.Problems come up in the second stage of the process :I want to place theses groups on the stage at a random position (easy) but I also want them not to overlap. I have tried to work something out with hitTest but I have miserably failed because whe I move one group out of collision, I have to check all of them again... and that brings flash into an almost endless loop that the previewer stops before it crashes my computer.
Of course, google has been (maybe I don't know the right vocabulary) and once again, kirupa is my last hope...For the structural aspect of this question, I have a main MC containing all groups (group0, group1, group2, ...) each group containing the pictures (pic0, pic1, pic2, ...). I also have room on my stage since the main container is draggable
View 4 Replies
Jun 2, 2011
I have made a functional to use a number of objects on the stage which should not load overlap with other object of the stage.But, Some time it goes stuck in infinite loops or overlap others.
View 1 Replies
Jun 2, 2011
I have made a functional to use a number of objects on the stage which should not load overlap with other object of the stage. But, Some time it goes stuck in infinite loops or overlap others.
Note:- I am attaching the files and screenshot also.
View 1 Replies
Oct 23, 2010
i have this script
Quote:
on (release) {
health -= 10;
if (health>500) {[code].........
I was wondering if there is a code i can use to replace the 10 with a random number between say 1-10.(Ergo when the script triggers the health is decreased with something between 1-10 instead of the set nr 10)
View 2 Replies
Aug 1, 2009
How to get say from 1 to 10, three randomly chosen numbers but simultaneously exclude the possibility of a repeated return (ie two 2s or three 6s)?
View 8 Replies
May 4, 2009
I have a mc and I want to use the Tweenclass in it. I want the mc to do random things. I tried everything i guess, just not the right thing
[Code]...
View 4 Replies
Sep 5, 2009
I want to load data into a random textbox. Example:
though i want the text to display under a random spaceship
View 8 Replies
Mar 23, 2011
On my stage is a dynamic text box and a "save button".The text box shows a random number which somehow does not save.In the fla file I added is a circle whose color can be changed from red to green, just to point out what I mean.
View 3 Replies
May 23, 2008
detailed as possible. Took basic Flash classes, but no AS other than searching online, taking a couple Kirupa tutorials, so it's all greek tho recognizably so. I have 10 individual "scenes" currently in one swf file, but would love to break these apart individually, and load each into a "container" swf with a "random" code (so each visit to my site starts differently) which I've located and tested with Kirupa's super "Loading random movies" tutorial. Question is: currently I have active buttons in each scene which advance playhead to the next scene. How can I code these to load another swf into the main "container" file and kill/replace the current swf?
Another tutorial "Transitions between external swfs" suggests "if your buttons are not located on the main timeline, you will have to change the path to the container movieclip" - but doesn't show exactly how to do this, and I have to say I can't figure the "path" out! Another issue I foresee is that I'll need the script to automatically pull in the next swf file when the current one finishes, if the visitor doesn't click the button first... Haven't been able to find this with a few hours searching, though some threads come close.
View 1 Replies
Sep 9, 2008
I want to load random movie clips into an area... kind of like ads. but each of them is a different length, so at the end of whatever clip, it has to be able to move onto another randomly loaded clip.
and for the kicker... it'd be nice to be able to add a button of some kind on the individual "ads" that will allow the user to skip to another randomly loaded ad as if that ad had reached the end of it's time.
View 3 Replies
Oct 25, 2007
I have a flash drop down menu that overlaps a separate flash piece in an HTML page. The example of what I am talking about can be found here: [URL]
When you hover over product types, you'll notice that the drop down falls under the 'water banner'. I have set the z-index of that specific banner to be lower than the flash header but it still did not work. When I change the 'water banner' to a static image instead of a flash file, the menu overlaps without a problem.
This is the style that I have applied to the navigation bar
#flash_piece {
z-index: 1;
position:relative;
top:0px;
}
View 8 Replies
May 6, 2009
I have 9 movie clips on stage that i am shuffling but some of the clip overlap each other how can i prevent this?[code]...
View 2 Replies
Oct 15, 2009
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?
View 1 Replies
Sep 22, 2006
I'm trying to use hitTest so that if any images overlap they will be replaced on the canvass.
ActionScript Code:
function imgSeed(){
for(i=0; i<5; i++){[code]....
although this works, It checks against itself, so it always true at least once, how can I tell it not to check against itself?
View 3 Replies
Sep 11, 2009
I want to add a lector in every frame with question. Everything works fine if i have 3 sounds of lector. When i add next, more then 3, in 4 frame sounds starting overlap on self.I dunno why, there is no error or warning. Funny is, if i change positions of sound for example add lector to 1,4,5 and 6 frames, overlap starting at frame 6 and next ones. I solved this problem by playing sound with AS3.
Here is a code:
Code:
var soundReq:URLRequest = new URLRequest("1.mp3");
[code].....
View 1 Replies
Mar 29, 2011
how can overlap a bitmap to another, setting the alpha of the top one in a way that I can still see the bottom one?Like if in photoshop I have to levels with one image each and I decrease the alpha of the top level.
View 6 Replies
Feb 26, 2009
Im using Flash CS3 with Action Script 2. I create a Flash file with few scenes in it. im using movie clip button in every scenes plus i embed .mov file in some of the scenes. I also have sound in every single scenes.
i create btnHDPage1 with instance name hd1 to be linked to scene1 and i create btn2 with instance name hd2 to be linked to scene2. (all these buttons are movie clip buttons). i have a sound and both scenes and a .mov file in scene1
The problem is, when i click on hd1 or hd2, yes it goes to appropriate scene. but the sound is overlapping and when im in scene2 and click on hd1 to go to scene1, my sound does not play and my .mov does not working.
[Code]...
View 4 Replies
Mar 20, 2009
i am doin a room planner where objects can be moved about 2 problems i got so far number 1 how can i make it so the objects can not overlap each other when the user drags them about 2nd problem is is it possible to put a arrow on the corner so when the user clicks it it spins round?
View 2 Replies
Jul 1, 2010
I am creating a flash website and I want to scatter images all over the screen. Now doing this part isn't that hard, as it seems simply as giving them random coordinates. However I do not want them to overlap each other nor certain areas.I haven't scattered them yet, I've tried though with hitobject etc. How can I solve it so they won't overlap each other?
View 5 Replies
Jan 15, 2011
I'm building a game in Flash (AS3), and I need to check for a 100% Overlap of 2 symbols.
View 3 Replies
Jun 24, 2011
I have designed an interface and on one of the pages there are thumbnails of book covers which you rollover each cover and on the "up and down" states ive included the blurb which has some details about that articular book. However not all books appear correctly, the blurbs go behind the other book covers. All the books covers are placed on a single keyfame in the timeline, i have tried it on separate layers as well but got the same result. above the screenshot of the problem: Ive tried many ways to fix it and each time it is the same.
View 3 Replies
Oct 28, 2010
i have two draggable mclips on stage and need one of them two snap to the other whenever it passes over it. I tried with f(hitTestObject){ mc1.x = mc2.x; and mc1.y = mc2.y}, but it doesn�t work very nice.
View 1 Replies
Mar 22, 2012
I have two movieclips and I want to test if they have collided. However, I want them to still be able to touch eachother (i.e. no pixels between them) without them registering that they have collided. I'm using the following code but it doesn't quite do the trick for what I am wanting to do:
Code:
thisMovieClip.hitTestObject(thatMovieClip);
View 1 Replies
Feb 15, 2007
I'm trying to simply draw a solid shape consisting of various other shapes, however, when I overlap two shapes, the overlapped area becomes transparent again. For instance:
Code:
var myShape:Shape = new Shape();
myShape.graphics.beginFill(0x000000);
myShape.graphics.drawCircle(10, 10, 25);
myShape.graphics.drawCircle(20, 10, 25);
myShape.graphics.endFill();
this.addChild(myShape);
The above code is AS3, but I believe the same thing happens for AS2 as well. The overlapping area between the two circles is not clack.
View 1 Replies
Oct 13, 2010
I have two rectangles, one of which is draggable, and when hitTestObject occurs I want to prevent the overlap.
here is the code:
addEventListener(Event.ENTER_FRAME, detectColl);
redSquare.addEventListener(MouseEvent.MOUSE_DOWN, grabIt);
redSquare.addEventListener(MouseEvent.MOUSE_UP, dropIt);
[code]....
View 2 Replies