ActionScript 3.0 :: Create An Object That Follows Another?
Mar 5, 2011
What i need.(No need for an fla file, just guide me through what codes i should use, things like that.)A turret, that every X seconds it should fire a bullet and the bullet should follow the object enemy.What ive got till now.Turret, Bullet and Enemy are 3 different classes. And i got a Main class also, that at the moment just create the enemy and the turret and put them on stage.Turret class creates the bullet.(I managed to create the bullet and the x and y position of the bullet is where my turret.x and turret.y is.)
So i just need the bullet that move towards the enemy.And BTW if you know any tutorial to make a Turret Defense, Tower Defense or any game above those lines, that just uses external classes, no timeline involved. Plz reply with link.
Alright, I've looked online at a bunch of different collision tutorials but they don't explain what I'm looking for. I want object A to hit object B and then execute a function via to a Event listener.
I'm trying to create a boundary for a player object, controlled with arrow keys, in my game using the main stage's height and width. For example, one test point is at the top edge of the player object's bounding box so that when the player object's head touches the stage's top edge, the player can't move anymore to the north. The player object is manually instantiated to the center of the stage by using the Flash stage editor so it will start at the center before the program starts.The problem is that right at the start of the program, I can no longer move the player object up or down with the arrow keys but I can still move it left or right. The intention is to allow the player to move north until the player object's head touches the top edge of the main stage.[code]
How can I create an xml object (or any object in fact) named after a variable, i.e variable called section with value "names" create object [section value + "XML"] = new xml(); result: empty xml object called namesXML
Iv been having some real trouble lately attempting to create an object panorama, emphasis on the object version, iv found plenty of tutorials on how to do regular panoramas (ie, from one spot looking outwards, i want to make one of something looking inwards orbiting it) iv used flash quite loosely before in the past and have come to the conclusion from various articles on the internet it is capable and probably the best way to make a small file size.
basically what i wanted was to have it so that when u click and drag side to side it would show around the object, im not too worried about how fast around it goes or if it accelerates the further away from the centre its dragged, just the main control im looking for. at the moment i have 180 odd pictures of my model im looking to orbit, or less or more depending on what people think is better (its a 3d render i made so i can choose how many pictures it has) or iv already got it stitched together into a video.
the ideas id already had were that it would load each picture into an empty movie clip based on the frame number, ie it would load model001.jpg on frame 1, model020.jpg on frame 20 etc etc, but that didnt work as i suspected and it seems to flicker which i probably should expect as it has to load each picture each time. my other idea was that if its possible to make a movie scrubber, and load the video of the orbiting object in, then just use a scrubber to control moving it around but i couldnt find anything (that wasnt to buy) on how to do that.
I am creating an actionscript video player in Haxe and to avoid the asyncError I am trying to create a custom Object. How do I do this is Haxe? The client property specifies the object on which callback methods are invoked. The default object is the NetStream object being created. If you set the client property to another object, callback methods will be invoked on that other object. Here is my code.
I'm tring to create instance of class, when I got name of this class.I think better to explain my problem will be this code:[code]I invoke some Function, and I get error: [Fault] exception, information=ReferenceError: Error #1065: Variable Level0Img was not defined.
I've been starting to create my own classes for a project and I've encountered an error that I don't know how to solve. This is for a Game class collection.
How do I create an object with ActionScript if I only know the name of it? I have a class that should add an object as a "grid" and place it accordingly, so if I have a Square box that I want to place by 4x4 on the screen it calculates it automatically. Well, that's the goal anyway.
I have a function in my Grid class, Add_Background that accepts an Object to be added as the grid background. I use a movieclip (don't know if I can use a graphic element).
I call the function myGrid.add_background("name_of_my_movieclip") or myGrid.add_background(new name_of_my_movieclip());
The first one I don't know how to use, I don't know how the syntax for creating an object this way (etc: grid[a][b] = new name_of_my_movieclip() doesn't work...) so there has to be some other kind of way on how to pass this to the function and that it knows what to do with it.
The other thing I've tried is passing the object to the function (new Grid_Background() etc) but I can't clone the object anyway I try it and the ActionScript reference site says there's an mx.utils.ObjectUtil that I can use for this, but I have no access to it that I know of (tried it).
I followed the tutorial at URL... and now have a basic platform game. I understand actionscript some what, but not very well. I just have a couple of questions about improving my game:
1. How can I create an object e.g. door/ portal that will take me to another level or location?
2. How can I make that new level/ location?
3. how can i make it that when i kill an enemy it puts my score up by 1?
4. how can I create a pause screen: for say mid game I press 'P' which takes me to a screen with options such as resume restart and main menu, that when I resume lets me carry on from the point I paused at?
5. How can I change it so that the enemies on the game wont kill me straight away, but just take away a life?
6. How can I change it so that instead of going back to the start every time I lose a life, I simply lose a life and continue?
I'm new to Flash AS3. I started making a game and I am a bit confused. Let's assume that I want to create a game that has multiple levels/modes, how can I do this in an object orientated way?
When i create games in other languages e.g. XNA C#, i create a separate class then create an object of that class within the main class and run the game based on a simple statement.
Basically i want to create XMLDesigner kind of thing in Flex, using which user can add/edit components and properties of view/dashboard. i am storing view structure in a xml file. i parsed that file at runtime and display view. How to convert an object (having properties and sub-objects) to xml node (having attributes and elements) and add that xml to the existing xml file. so that next time when i parsed xml file i'll get that new component in my view/dashboard. for e.g, object structure of component in xml file :
I have no problem reading XML, but I want to create xml. Is there an easy way to created XML from an object? For example: Code: var xml:XML = new XML("<images></images>"); XML.prettyPrinting = true; var imageXML:XML = new XML('<image x="10"></image>'); xml.appendChild(imageXML); trace(xml.toXMLString());
Could be something like this: Code: var xml:XML = new XML("<images></images>"); XML.prettyPrinting = true; var image:Object = {x:11}; var imageXML:XML = new XML(image); xml.appendChild(imageXML); trace(xml.toXMLString());
I have a graphic or movie clip as an example which is a water bottle. An what I wanna do is that depending on what is the user response, in my case is how long the person is doing some activity, depending on that I want flash to generate a number of graphics/movie clips on the screen. As example the person says that takes 6 minutes doing "x" activity, so as a response of a button click which says "generate consumption", it generates on the screen how many water bottles he has consumed for that range of time doing that activity, for example each minute is 2 water bottles, so it has to generate 12 water bottles on the screen when the user press "generate consumption".
So I hava array Links and array Params with same langth NSo what I need is to create an object where for each link from Links I will be able to see param from ParamsAnd than for example to be abble to call something like
for each( item in object) if (item.param == "some value") { // some code
In my actionscript program, I draw a polygon using the methods : this.graphics.moveTo() and this.graphics.lineTo(), and in the update function of the polygon model I change it a bit, and then draw it all over again. Eventually, every call to the update() function draws the updated polygon and I can see it changes.
On some point of the program, I want to be able to use this polygon as a movieclip, so I can attach a mask to it - so as the polygon drawn over and over again, I could see a nice background in the form of that polygon, fills it inside.
Problem is - I do not know how to take this array of points I have, which is my polygon representation, and turn it into a movieclip ( if possible at all... )
I created MovieClip, "Exported it for ActionScript" with the same name. It's okay when I create an object visually, by dragging it to the stage but when using var smth:* = new myClass() an error occurs. There is an error because I have some code in the MovieClip I exported, and it involves the Stage. It happens so that stage is not instantiated at the moment of running code? I mean, I'm creating the object on the second frame so it's seems kinda impossible. When (in the MovieClip) I write trace(stage); output is null. As I said, there is no problem when creating object visually.
Ok so I'm a noob when it comes to Flash so this may be really simple but then again it could be extremely difficult I don't know. I need to create a Flash document that contains an object that can be rotated 360 degrees using a scroller using pictures of the object probably in jpeg format.
First: When creating a Vector, does it have to contain a Flash data type (uint, int, Number) or can I have a Vector of objects I created classes for?
Second :I cannot instantiate a Vector object. All of the documentation I am finding is saying[code]
I get "1084: Syntax Error: expecting identifier before lessthan". I was thinking that maybe I needed to include a library, but the error seems like it knows that I am trying to create a Vector.
I am creating an animated menu for my personal website. All I need is a MouseOver and a MouseUp event on the same object. Because of the scrolling nature of the menu, I need to have MouseOver events on each menutab. Each menu item is hidden until a MouseOver event, then it scrolls out to reveal its title. If the user clicks on the now-revealed tab, it should become the current page. If the user does NOT click the now-revealed tab, it reverts to displaying the current page's tab instead.
This means that I need to have a MouseOver and a MouseUp (or Release) tag on my items. Since I probably confused you all as much as I just confused myself, here is the example. [URL]. The "Family" section should be displayed. As you can see, when the user runs the mouse over other tabs, they are revealed. When the mouse goes away, it reverts to the Family section because nothing else was selected. The menu operates on frame 2 - frame 1 sets the initial variables as shown.
Code: var sel = "family"; var games = "0"; var movies = "0"; var artwork = "0"; var yugi = "0"; var about = "0"; var links = "0"; Frame 2 operates my rollovers in a frame action as shown. [Code] ......
I've finally got the animation and MouseOver events done - all I need is a MouseUp event! Why it doesn't accept MouseUp or OnRelease events? This is, of course, a work in progress. A few artifacts of testing:
* The green squares on the left of each tab are invisible buttons to activate my rollover. I wanted to see them during testing. * The blue rectangles sometimes visible over the tabs' text was a theory gone wrong; I was hoping I could click those rectangles, which are buttons (which would be invisible) to initiate the MouseUp event instead of the actual tab, which is a movie clip. * Needless to say, graphics are temporary! LOL * Coding is also not optimized yet, so it's a little messy for now.
I'm trying to make a game, but I'm stuck on a few conceptual parts that I'm not sure how to handle.
I want to create an object that changes its picture when I click on it. My idea was to have a creature that once you click on, changes to a different state. For example, you have a picture of a balloon and when you click on it, it plays the animation of it popping.
I have no idea how to do that, I've looked at buttons but it doesn't seem to persist in the state once you click on it. (or maybe it does and I'm just not doing it correctly?)
I'm using the following code to create a sendandLoad loadVars Object but it suddenly quit returning data and no matter what i do i cannot return a value.i'm useing aspx to return the value the response code looks like this. Response.write("success = success"); Ive also tried Response.write("&success = success"); but neither works and i also don't send data here is my code.
I have written a Class for skinning the UI. The Class works by taking a movie clip name from the stage passed to it and create the skin for it.So I create an Object from the class such as this:
Code: var CBox:UI = new UI();
Now what I wanted to do is reference a movie clip from the stage to this CBox variable, so when a call the Class methods it will know which movie clip to work on! Since currently I have to do this:
Code: CBox.Skinning(content_mc, "content", 100, 200); or CBox.Over(content_mc);
As you can see Im passing the movie clip, content_mc, everytime. I just want to avoid this by creating a reference.
I just started in as3 after a long break from flash and I have run into a slight problem and couldn't find any readily available solutions online so I thought I'd ask, I'm trying to do something like this:
Code:
switch(characters[ps[1]]) { case 0:
[code]....
I want to create a different object of the same variable name with the switch statment but it gives me "1151: A conflict exists with definition player in namespace internal" which is of course because I'm redeclaring the variable. I'm not 100% sure it technically exists in the current scope though (but it must because I am getting this error.) I also tried a few ways of initializing as just MovieClip up topside and then just try and typecast it down here but as can be assumed that didn't work either.
Is there a way to get my intended effect or am I gonna have to make some like an above class containing all these other classes on it's various frames and just instantiate those?