Actionscript 3 :: Make Object Obscure Specific Objects?
Mar 17, 2012
Right, so here's the scenario: I have 4 objects, A, B, C and D. What I want is that C obscures A, but not B. Similarly, I want D to obscure B, but not A. A and B can overlap each other in any order, it doesn't matter.In other words, what I want is an object (C) to be able to cover one object (A) but not another (B), even if it comes into contact with it.Same with D, which can cover B but not A, even if it comes into contact with it. The problem is that I can't think of a layer configuration that allows this: D will always be higher than both A and B, and thus will obscure both.I'm not expecting anyone to come up with some unfathomably clever configuration, but I'm wondering if there's some kind of ActionScript that can do this. In particular, I would like A and B to be dynamic TextFields, and C and D to be MovieClips of any shape (i.e. not a rectangle).
i want to make 3 objects move in a square pathi tried to use guide layers but it didn't work good for both three objectsonly the first object followed the exact pathis there some other way to do it??
make my hero go back to his shelter when he finds some food or when he approaches an enemy. It looks like this:
1. The hero is in the shelter. 2. The hero is hungry. 3. The hero leaves the base to hunt some animals down. 4. The hero is full and is headed back to the shelter. 5. He moves in the direction of where the base is.
So, once again, how do I make my hero go back to where he came from? How do I make my hero's x and y position to fit the way back home?
I have been posting some threads about parts of this problem and finally i am able to make the stars successfully form what i have set-up in their movieClip, but only once.The problem now is that i am trying to make the stars follow this list of actions:Spread the stars initially and then make them form the existing form in the movieClip(works);Change the frame in the movieclip to anoBelow i will have the code explained and show where i think i have my issue:Create the Position x and y arrays and Spread the stars
Code: var xInitial:Array = new Array(); var yInitial:Array = new Array();
I am working on a project that uses PHP, AS3, and AMFPHP. The project allows users to upload and download images among other things. Since I am fairly new to PHP/FLash security I have been trying to gather as much info about making things as secure as possible. I've got some good advise about using .htaccess files, and a few other tricks.
My main question at the moment is how to hide the "path" info from and to the PHP / assets / and to and from the AMFPHP services ... Currently I have all the paths hard-coded in one .as that returns an object with the paths to any of the other classes that need/request it. I found this method to work well since I only need to change this one .AS , and it will branch out to the other classes that need it.
I'm using the drawing Api to create a shape on the Stage; I'm then pushing the shape to a sprite object and applying a mouse event to the sprite. I'm generating a textField dynamically (over the sprite), and setting its selectable option to false. Everything displays all well and good, and you can't select the text, but the mouse event will only trigger in the space between the textField and the sprite.
In As2, a non-selectable field would basically be ignored by the mouse, but that seems to have changed? Is that true? If you guys want to see the code, I'll have to make a sample without the 48,000 classes that are involved, but I thought I'd ask in the meantime in case this is some simple As3 issue that I'm unaware of....
What I want is a hint how to make a specific thing happen while clicking a specific button. Like "if I click button 1, do this". Would like to use this script though I'm gonna add buttons over time and this is an easy way to have the functionality working.
Here's the code:
Attach Code
function hitButton(btn) { btn.onRollOver = function() { this.colorTo (0xC4006A);
is there a way to have (the postion of) objects be dependant of another one? I have attached a simple .fla file with two boxes (MovieClips) that grow in height. Since the position of the bottom box is constant, the top box soon expands "into" the one below so that parts of it are hidden. What I want is that the gap between those two objects stays constant (in this case 50px). So, is there any way to make the position of one object dependant on (the size of) another? Or is there any other "workaround"/tip you can give me?
How could I get a number of all same objects in array (lets say I have five "Grass" objects and ten "Wood" objects. Now I want to get the number of Wood objects.
I have 4 objects in the library. I use a switch case statement to randomly generate them to the stage;[code]When the user clicks "taskMC", I want to assign behaviors according to which object. If I trace "taskMC" I get the name (object A_Graphic, object B_Graphic etc.)but I can't assign actions to them that way. How do I get object A_Graphic to do one thing, object B_Graphic another thing...?
how can I drag a specific image without dragging all the other objects. The image to be dragged is exported dynamically from the library and activated on a mouse over. Here is the code:
function myImage(event:MouseEvent):void { var img:BitmapData=new livery(0,0); var MyImg:Bitmap=new Bitmap(img);
I am using Flex to create a small form. All I have at the moment is a List component, that I want to populate with a list of font names.I am getting the fonts using Font.enumerateFonts(true);. This returns an array of flash.text.Font objects.
The Font objects have a fontName property that is a String of that fonts name.My problem is that I can't figure out how to bind the List's dataProvider to the fontName property of each of the Font objects in the Array.Is there a way to do this just with binding? and not creating a new array of Strings by looping through the Font objects?
Im using Oracle, BlazeDS, Java and Flex. I have a list of objects displayed in a datagrid(Lets call them Main-objects. Each of these objects have a set of UserComment-objects associated with them(One-to-Many relation in the DB). These comments may come from two different "types" of users, distuingished with either a 1 or 0 in the UserComment-object's "userType" field. Each time the user selects a Main-object in the datagrid, the UserComment's related to this object is displayed in a separate datagrid below.Based on the introduction, i want to separate the UserComment's into two separate datagrids (one for each user-type), instead of the one i have now. So my question is: What is the best approach for performing this task? What is the best way of separating the UserComment's into two separate data grids based on the value of the "userType" field?
I am developing a mini flash game. Player control character and move left and right to collect money coin. There are 5 points that money and bomb release and move from top to bottom. When character collide with money then increase money else hit bomb age increase by 1. Once the age is 99, the game is over and the money is the final scores
Here is my code: package Class { import flash.events.Event; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.media.Sound; [Code] .....
This is my Game: Currently, the bomb and money random appear X, 100 with 15 money and 10 bombs in a screen. What I want is, how to amend it become money and bomb appear from specific point, after that the money and bomb when hit the wall will bounce back. An example similar game play with my game is [URL].
I may just be forgetting something really simple here but I'm stumped.I have 2 guys on the stage.I want one guy to do a certain amount of damage and the other to have a certain amount of health. The problem comes from having hundreds of guys coming and going and they all need to have stats attributed to them.I don't know where I could store those variables so they can be referred back to in the code. The guys on stage are all named guy1, guy2, etc. and it would be nice if there was a way to just say guy1.health and guy2.damage and store the variables in the objects themselves somehow.
Also, I already tried putting "var health = 10" in the actual objects in the library but for some reason it takes 2 or 3 frames in game for the code to call those variables from inside the object and it causes a lot of problems. Am I missing some much easier way to do this?
I am encountering a problem in my app only when it is run in flash player 10.1.85.3. Some earlier player versions I have tried are working fine.From what I can tell it seems related to the following:
Quote:
from here: h[url].....
When searching for objects (not strings) in Dictionary objects using the 'in' operator, if the object is not found in the Dictionary object, it will be searched for in the delegate objects. With 10.1, the toString operator will be called on the Object if not found in the Dictionary. This can cause problems with Proxy objects who need to define the callProperty function or it will generate a RTE. ...what it means "it will be searched for in the delegate objects"?
I have an object inside my flash file and i want to lock the object on 0 x-axis 0 y-axis but when i re-size my SWF file my object's location changed to another location how can i fix that?
Inside the attached .rar Two seperate objects are made, object A and object B, but they share the same variable (only works with arrays) even though they aren't linked in any way. Any changes made to A is reflected in B, and vise versa.
How would I go about fixing this issue? (SIMPLY, aka I don't want to write a class or whatever, I just want to know if I am doing something wrong, like not writing new or something)
I'm using AS 3.0, and I'm trying to change the frames inside a specific object's timeline.The change will be triggered by keyboard events, but I don't know whether to add the eventlistener to the stage or to this. Also, it doesn't seem to be responding to anytime I use a gotoAndStart() or gotoAndStop() it just ignores it completely. Is it calling the stage's timeline when I call this? It also doesn't help when i add this.gotoAndStart() or this.gotoAndStop(), so how do you change the frames outside of the main timeline?
I've used this code to detect a hit between a specific object and a certain MC Code: if(this.hitTest(_root.ufo)){ Now I want to know if its possible to detect collisions with everything except (ignore) certain MCs because I only have 3 MCS I don't want it to care about, but there will be about 200 or more I want it to care for.
I am having an issue with the setVolume() function. My problem is that when I set volume of a specified sound object the entire flash file is affected, meaning that all sounds are affected (The ones created by AS). Not just the single sound I specified.
Here's the line, which "mutes" the sound: Code: music_main.setVolume(0); The "music_main" object is created through these lines: Code: music_main = new Sound(); music_main.attachSound("MAIN_THEME"); Now my problem is what I stated above. All Sound Objects created are affected by the setVolume() function. I only want to change the "music_main" object.
ive used this code to detect a hit between a specific object and a certain MC
Code: if(this.hitTest(_root.ufo)){
now i want to know if its possible to detect collisions with everything except (ignore) certain MCs because i only have 3 MCS i dont want it to care about , but there will be about 200 or more i want it to care for.
I'm making a game that's similar to Pong. Basically instead of a long, skinny paddle, the paddle is wider -- but this creates some problems when hit testing.
I don't want the ball to be able to hit the side of the paddle, only the front of it (the side facing the other paddle, technically the side part). I'm basically wondering how I can run a hit test in AS3 but for only one side of the object. The object is a basic movieclip.
How to make sure the sheep will only appear on the green field on the left hand side? I use the following but they appear all over the place. onClipEvent(load) { _x=Math.floor(Math.random()*379+150) //where width is the width of your stage _y=Math.floor(Math.random()*376+150) //where height is the height of your stage }
How can I make an object following my cursor ( but not directly) through a specific path (something like a city plan) and every time my cursor change location the object would change path so it will stop where my cursor is?
In a movie a have a sound object, that i make it through (for example)[code]I have many other sounds in the movie but this object is for a loop... The problem is that when I set the volume for that object, through:[code]
I have created an infinate menu, given the buttons frame actions, but because you can't have a on release action on the sliding menu I don't know how to make each button go to the specific url. the link is below [URL]