Generic Objects? Clipping?
Hello,
I am an amateur programmer (no formal training of any kind) and I have been messing with Flash for a good while. I have a pretty good handle on most of actionscript but there are a couple of things that I can't seem to work out.
First, is it possible to refer to an object in a generic manner? For example, I have bricks and bullets, and i need the bricks to explode when a bullet touches them.
Currently, I would name all of the bullets manually (bullet_01 ... bullet_99) and have each brick make 99 checks (hittest with bullet_01, hittest with bullet_02, etc). I have always thought that there should be some way to test against a type of object, but I haven't figured out how to do this.
If I wanted to make 10 bullets and 1000 bricks that would be 10,000 clipping checks per frame - is there a better way? Am I worrying too much about cycles?
Secondly is the issue of clipping detection for making a platformer style game. I have seen many of these work well but whatever systems I devise to keep the player in check seem to slow the game down - I have to be doing it wrong, but I've been unable to find any tutorials/books that deal with handling clipping in games beyond simple space-invaders style stuff.
Can someone point me in the right direction?
FlashKit > Flash Help > Actionscript 3.0
Posted on: 06-20-2008, 10:01 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Combining Two Generic Objects
My problem is quite simple:
I just want to combine two objects and their properties together.
For instance if I have...
Code:
var appleObj:Object = new Object();
appleObj.type = "apple";
var orangeObj:Object = new Object();
orangeObj.shape = "round";
I would like to have a new object with all properties from both objects. Such as...
Code:
trace ( fruitObj.shape + " : " + fruitObj.type );
// result: "round : apple"
Dynamic Creation Of Generic Objects
Hey there,
I am quite new to AS, and so I wanted to start off with something quite easy to get some practice. I had an idea to create a looping animation that would create a look similar to the flight paths of these small flying insects that are found in central Australia. They are tiny things that fly around in close, concentric circles in the evenings. If you've ever seen them they look quite cool. Anyway.
I started by finding a simple function that would make a MC spin in a circle, then added a few extra parameters so I could dynamically alter each instrance's flight path.
The idea was to create a Dot [class?], then, using a loop from 1-10, create instances of this class, each with parameters that would then be sent to the circle function. I attached an image to each instance, using attachMovie. I then created a setInterval method, and passed on the paramters to the circle function. This was so the circle function would execute quite fast, and be controllable. I thought this was a better option than just onEnterFrame.
Nothing happens.
The circle function works just fine attached to a single MC, but I seem to get lost with multiple cases of dynamic referencing. The plan was to introduce some random functions within min/max to alter each instance's flight path slightly, but I haven't got that far.
Am I having issues with incompatible data types? Or is it a really simple, rookie mistake? Any help would be greatly appreciated.
Cheers
[fmx] Generic Function To Move Objects...
Alright so... I really don't know the best way to approach this. I had a LOT of code that I thought could be generalized into a function. I don't know how to explian it... here is the code:
i attached it...
I know it's a lot of code... I just... I don't know what to do with it anymore! When it was in a bunch of small functions, it worked (sort of) just seemed reallly messy and annoyed me. Anything to improve this is much appreciated! Oh btw its causing the hero to jsut go to 0,0 and then a hit symbol appears there, and then nothing happens, the hit doesnt even dissappear. If you have a better way... I would love one.
[fmx] Generic Function To Move Objects...
Alright so... I really don't know the best way to approach this. I had a LOT of code that I thought could be generalized into a function. I don't know how to explian it... here is the code:
i attached it...
I know it's a lot of code... I just... I don't know what to do with it anymore! When it was in a bunch of small functions, it worked (sort of) just seemed reallly messy and annoyed me. Anything to improve this is much appreciated! Oh btw its causing the hero to jsut go to 0,0 and then a hit symbol appears there, and then nothing happens, the hit doesnt even dissappear. If you have a better way... I would love one.
Clipping
Im sure there's a way to do this, but I can't find it. Let's say I have an MC that is 700 x 700 pixels. How would show 100 x 100 pixels of it, starting at 20 x 20 (to 120 x 120)?
Need Serious Help - Clipping
I need serious help with a clipping-style thing. I need it so you can't walk past the black and it almost makes a "wall".
Just work on this one and re-post it.
Thx!!!
Need Serious Help - Clipping
I need serious help with a clipping-style thing. I need it so you can't walk past the black and it almost makes a "wall".
Just work on this one and re-post it.
Thx!!!
3D Clipping
Hello
I'm new here , so I'm going to present myself fastly. I'm kiroukou a french student and flash developper for the fun
Ok now here is my question
I'm actually making a 3D engine, it works well, but I need to add a new feature that I don't understand so well : clipping !
I've found some tutorials on the internet wich explain the theory, but mostly in english, and it's not so easy for me to understand them
So I'm wondering if you can explain it to me, and with a piece of code will be great In fact it's basically how to find plan eqations and how to check if my point is inside or not.
Regards
Kiroukou
Clipping
Hi guys,
How do I prevent a Bitmap (or Sprite) from rendering outside it's parent ? I want the parent to act like a clipping rectangle.
Thanks.
3D Clipping
Hello
I'm new here , so I'm going to present myself fastly. I'm kiroukou a french student and flash developper for the fun
Ok now here is my question
I'm actually making a 3D engine, it works well, but I need to add a new feature that I don't understand so well : clipping !
I've found some tutorials on the internet wich explain the theory, but mostly in english, and it's not so easy for me to understand them
So I'm wondering if you can explain it to me, and with a piece of code will be great In fact it's basically how to find plan eqations and how to check if my point is inside or not.
Regards
Kiroukou
Clipping Paths?
Can you import clipping paths from Adobe Photoshop into Flash MX?
Thanks
Help Please.........Clipping Audio
Hi i am a new user and am trying to clip an audio file in flash but cant for ther life of me figure out how to do it. can anyone help.
ive imported it and tried to edit it but i cant seem to cut the section i want.
some help from you experts would be much apreciated
Thanks
Clipping A Canvas
I have a canvas that is say 600 x 100. I am creating a bitmapdata object that I want to draw the canvas to, but I only want to draw part of the image. The starting x value needs to be 50, and the starting y value needs to be 40. I was trying to use the clipRect property of the draw method, but that was not working... any ideas as to how to do this?
Clipping Mask?
Basically I have a rounded rectangle border and a larger picture. I want the border to frame the picture.
How can I use the border to create a clipping mask or cut away the parts of the picture that exceed the border?
Clipping In ActionScript
Hi all
I have a jpeg and I want to dynamically show a portion of it (a rectangle or an ellipse) and move it.
I suppose the right wording for my question is.. how do I clip images?
Clipping Path Question...
I didn't get any reply to this so I'm trying again. If this question makes no sense forgive the repost.
How does one go about importing a clipping path from photoshop into Flash 5?
I have tried exporting the eps from Photoshop and Flash doesn't want it.
My buttons look terrible without it:
http://carlokevorka.tripod.com
Clipping Imported Movs
I imported a mov file into flash and embedded it. I don't need the whole thing, however. I just want 200 out of the 600+ frames. But when I delete frames from the beginning, it takes them off of the end rather than sliding the whole movie over. When I add a keyframe, it starts the movie over again at that point. Anyone know if this can be done in Flash? I don't really want to edit externally, since I'm low on Hard Drive space, but if I have to, could someone recommend a mac program that would do the job?
IE Win Clipping XML Generated Text
I haven't stopped by here in over a year, but i really have nowhere else to go...
I'm having this annoying issue with a simple flash marquee. It simply doesn't work in Internet Explorer (Windows). I've tried it in every other browser I could e.g. Mozilla, Safari, IE (Mac), etc. and it works fine.
I have no clue what's going on. Any ideas?
Here's the URL:
http://www.mc2.com.ky/beta/adtech/html/cabling.htm
...and here's a link to most of the code:
http://www.mc2.com.ky/beta/adtech/html/marquee.txt
Thanks in advance! I missed you guys.
Clipping Error On Sprites, Please Help.
To begin with, this is my first post, and I am very new to Actionscript and Flash MX.
Nevertheless, I have put together a short Flash Animation at:
http://www.semicolonsmile.net/ud/splash.html
The Flash Animation is the 13 Animated Gifs that make the characters, these gifs are all now movie clips with a second layer over them that is a button at 0% alpha. These buttons play movies that fade over the main screen and show a close up, anime-style drawing of the character.
But, for most users (it may have something to do with RAM, as most people with problems had less than or about 512 mb of RAM) receive this glitch:
http://www.semicolonsmile.net/ud/glitch.jpg
As you may have when trying to view this.
The movies and character sprites are all on the same frame, but different layers. The shadows are also on an independent layer.
Is this flash not being able to display everything that I am trying to tell it to display? Is there any way to fix this easily? Or should I make an Actionscript tag that tells each button to play a certain movie? In short, what should I do?
Thank you for any help that can be given.
Clipping On Text Mask
I work on my colleges web page, and we are doing a series of small ad segments. They consist of pictures masked by text phrases; the text is animated to reveal the pictures behind. The text expands, revealing the picture through the letters. My problem is that as the text zooms out, the hole in the middle of the o gets "clipped" in one spot. While previewing the FLA file's timeline in flash, it looks normal. Once the file is published, however, it clips (also clipped in the test movie preview). I will try to find a way to post the file on here. As far as I can tell it is not something I have done in the tweening becasue the tween is a fairly straight-forward text expansion. I made a crappy quick tripod site. The flash is at the bottom where the text link says flash.
Site
Printjob Clipping Problems
I am using printjob to print a movie clip that is dynamically created based on external data, therefore the movieclip size changes depending of the data. Most of the time the movieclip size is larger than an 8 1/2 x 11 size sheet of paper and consequently gets clipped.
I am able to print the entire movieclip by scaling to 30% or less, but I'd like to have the movieclip print a bit larger and just print onto a second sheet of paper. What is the best way to do this?
ActionScript And Sound Clipping
Can someone settle a question?
Are there any libraries or functions that exist in actionscript (2 or 3) for importing audio, clipping said audio on the fly, then exporting the audio?
Like, let's say there's a client app for doing media mashups. Could actionscript in the swf allow someone to upload an audio clip to the swf, clip the audio within the swf, then export the new clip--all on the client side, no server?
One person says yes, this can be done all within the swf.
I'm saying no, not possible.
The reason I'm saying no, not possible, is that there are no actionscript methods for exporting media out of a swf. The swf would have to pass the audio clip to a server, which the swf would then download, which could then be manipulated within the swf--but the only thing that could export at that point are variables to a server side device to actually retrieve the original audio clip, cut it up, then export it. Maybe a flex or php or perl architecture.
Who's right? Either, neither? There is honor at stake! :)
werd.
Papervision3d Clipping Question
does anyone know how to prevent clipping / missing polys between two objects, say cube and cube, when the two collide. I've tried adding more segments already.
Borders Clipping & Masking
I'm having a really hard time understanding how AS3 handles object "clipping". Okay, so let's say I have a sprite which is 10 pixels wide and 100 pixels tall. I create a new movie clip which is 10 pixels wide and only 50 pixels tall. I add the the sprite to the movie clip, and then add the movie clip to the root or stage:
someMovieClip.addChild(someSprite);
addChild(someMovieClip);
I only want the first 50 pixels of the sprite to show up, but the whole thing is there. AS3 doesn't mask or clip to the boundaries of the containing movie clip! How do I do this?
Masking Vs. Clipping/croping
Hi guys,
I understand masking movieclips, and theyre working - and after some experimenting what mask seems to do is only visually mask the movieclip, the entire object underneath the mask still exists in its real dimensions and thus can affect the layout of other elements around it.
So what id like to know, how can i achieve the same masking affect, but actually crop or clip the object that the mask is being applied to.
I guess in HTML/CSS the equivilent would be to put a large image inside a div, then set the width/height of the div to be much smaller than the image and say 'overflow:hidden'. The image is still its original size but only a portion of it is showing, and more importantly the image size doesnt affect the layout - only the dimensions of the div that contains it.
If you dont understand what i mean ill post a screenshot, thanks!
[AS3] Event.ENTER_FRAME Getting Clipping
Hey,
I am trying some animation using actionscript and the only place in the code that changes the propeperties of any ojbect that is in displayList is called like:
ActionScript Code:
addEventListener(Event.ENTER_FRAME,drawTree);
private function drawTree(e:Event):void
{
// change some properties of objects in the display list.
//like dispObj.x = 23;
//like dispObj.y = 23;
}
framerate i am using: 50
The problem is it looks like I am getting clipping or something? when the green squares are animating and the object isnt fully drawn or something when the screen is being refreshed?
example of clipping:
http://www.davegeurts.com/TTas3/tree.html
THANKS for anybody with some free time!
Clipping Path Import Qvestion
How does one go about importing a clipping path from photoshop into Flash 5?
I have tried exporting the eps from Photoshop and Flash doesn't want it.
My buttons look terrible without it:
http://carlokevorka.tripod.com
Clipping Paths Imported Into Flash MX
I'm just looking for some sanity or understanding here....
At work the other day I was able to take a jpg into Illustrator 10 and place a clipping path over a human shape on the jpg. I then used illustrators export feature and exported the file to a swf file. I then imported the swf file into flash and I was able to move the picture around with the clipping path intact.
I tried doing the same thing at home tonight yet it is not working at all. I am using illustrator 10 and flash MX at home as well. Have any of you been able to duplicate this process?
Rounded Button's Circular Clipping...
Hi,
I have rounded buttons in Photoshop that I want to use in Flash. Is there any way to preserve the transparency around the edges, short of masking the buttons in Flash?
I thought I read that PNG files support transparency, but this doesn't seem to work for me. (I've been using JPG files from Photoshop for my bitmaps.)
Thanks,
Todd Lerner
Advanced Antialiasing Clipping Text
Anybody else finding that using advanced antialiasing on text created with createTextField causes the right hand character to be clipped? What can I do to remedy it? Everything's fine when I set it to normal.
thanks
mark
flash8
[F8] Eliminating/clipping Graphics Off Stage
Have an animation of a bunch of gears turning. The gears are so big half of them are purposely off the page.
How do I go about making it so that when somone views my animation they see only the stage area and not that part of the gear extending out into space. What I had done was make a layer with big rectangles surrounding the stage, and the rectangles would be the same color as the background color in my html doc. Is this the right way to do it? Does this increase the screen area of my final swf to the size of the stage plus the size of the rectangles surrounding it?
[F8] Transparent Clipping Paths From Photoshop
Hi Everyone:
I have some geometric objects that I created in Photoshop from pieces of ice - anyway- I need to get these into Flash. I've tried saving the files out of Photshop as eps doc's with clipping paths, but it still comes into Flash with the white around the object. Is there a way to preserve the transparency of the clipping paths in Flash? Thanks a bunch for any help with this.
Regards
Kiawah
Clipping Bounds On Sprite/MovieClip
Easy noob question for you: I'm using addChild() to add bitmaps to a 100x100 Sprite. I'm positioning these bitmaps with their x and y parameters. However, if the bitmap 'spills' over the edge of the 100x100 Sprite, I want it to be clipped. In other words, if I place a 50x50 image at the x,y coordinates of 90, 90, I only want the upper-left corner 10x10 pixels of the image to be shown. Does that make sense? How can I do this? Is there some 'clip' parameter?
Thanks in advance!
-Rich
Gif/png With Mask/clipping Path Over A Background
I'm fluent in Photoshop, Illustrator and am decent in Flash (but it's been a while).
What I'm trying to do is to have multiple masked objects (images - not vector) fade in and out over a background that is also in motion. My client has provided me with a psd with all the images, text etc. on layers.
I've made gifs w/transparency but no matter what I do, there's a white line around the edge of the graphic. Image was made in PShop by erasing everything except what was desired and saved as gif/trans. White edge appears due to being on a dark background...I edit the gif in PShop and erase the whole outer edge, save, update and it's still there!
I've messed a bit with the mask feature in Flash and am stumbling thru Fireworks editing, but just cant seem to make this work right!
I can't find a source of info that is in-depth enough to help me out.
If you have any suggestions, I (not to mention my client!) will very much appreciate your wisdom!
Clipping/cropping A Movie Clip
Hi,
Ok, I did try searching this one but found nothing so either my terminology is incorrect or I'm jus' plain stupid.
This is what I have:
I've created a movie clip for a preloader. I have what will be the viewable area that is masked. Behind this area is another movie clip that is tweened to create an animation.
What I need:
I want to clip out or crop the irrelevant "stuff" from the clip so as to only display my chosen area.
What I would normally do but it wouldn't work here:
I would normally go in after creating all my anims etc. and create a mask shape. I would then convert anims to keyframes, remove tweens and break apart everything to shape-editable state and punch all the unwanted bits out using the mask shape. This is possibly not the most efficient way of doing it but I normally get by doing it like this. The reason I can't do it this way here is because I need to retain the movie clip in the background, so breaking apart is not an option.
What I'm left with is a VERY large (dimensions) movie clip with only a small area somewhere in the middle that will be viewable. I could mask out the entire unwanted area but I get the feeling there is a better way to do this? Some way of defining where the viewable/renderable area of a movie clip is?
PS. I'm no actionscripter - as you probably can tell.
Any help would be greatly appreciated.
Flv Movie Embeded In Flash Clipping
Dear support team,
Pls check this movie and tell me how I can make it stream better . I have adsl , the flv is about 16GB , swf is around 450 KB .... is the problem with my movie , my web age, my server....??
Best regards
Flv Movie Embeded In Flash Clipping
Dear support team,
Pls check this page and tell me how I can make it stream better . I have adsl , the flv is about 16GB , swf is around 450 KB .... is the problem with my movie , my web age, my server....??
http://www.roulasorour.com/drawings_mov.html
Best regards
Flv Movie Embeded In Flash Clipping
Dear support team,
Pls check this page and tell me how I can make it stream better . I have adsl , the flv is about 16GB , swf is around 450 KB .... is the problem with my movie , my web age, my server....??
http://www.roulasorour.com/drawings_mov.html
Best regards
Flv Movie Embeded In Flash Clipping
Dear support team,
Pls check this page and tell me how I can make it stream better . I have adsl , the flv is about 16GB , swf is around 450 KB .... is the problem with my movie , my web age, my server....??
http://www.roulasorour.com/drawings_mov.html
Best regards
[F8] Importing Illustrator Clipping Mask Into Flash
I have been unsuccessful in bringing an image into Flash from Illustrator (CS2) that has a clipping mask. When I test the movie, the parts of the image that have been hidden will show and when I rollover a button with that masked image on it, the mask itself shows (usually a bright red square). I've tried exporting it different ways and haven't had any luck.
Is it even possible to bring in clipping masks from Illustrator into Flash? Am I attempting the impossible?
[MX04] Graphic Clipping/Stage Width
Hi All,
I'm new to the forum, and pretty new to Flash, but it seems like a place full of on-the-ball people, who I'm hoping will have an answer to my problem.
I have a problem with my first Flash game project, and I have searched the forum, but not been able to find a solution. I hope someone can help.
I've approached writing a game from what I'd term a programmers approach in that I have a single frame where everything is controlled via onEnterFrame(), branching out to ActionScript functions. Simple.
I have set the stage to be 485x364, and when I display these values on screen either in the IDE of in IE they display correctly. In the menus, and in-game, I use 96x96 images, tiled, to display the background. So, to completely cover the stage, I need to display 6 images wide and 5 high. When I "Test Movie" though, what I actually see is a stage that appears to be 576 (6x96) wide and 480 high (5x96).
My question is, does Flash automatically clip to the boundaries of the stage? I thought it did. I've included a link to just the menu system of the game below, and what also confuses me is that when the embeded Flasg object appears it seems to be full window size. I've got Stage.scaleMode = noScale.
I've also given the HTML code used to display the SWF.
In "Test Movie", all other functions that display graphics centred on screen, like my font control fucntions, work fine, and everything is centred according to stage width, but looks offset because I'm actually showing 576 pixels wide instead of 485.
Link and HTML code
http://www.silicon-wizardry.com/Moodz_Flash.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Moodz_Flash</title>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%" id="Moodz_Flash" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Moodz_Flash.swf" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
<param name="bgcolor" value="#ffffff" />
<embed src="Moodz_Flash.swf" quality="high" scale="noscale" salign="lt" bgcolor="#ffffff" width="485" height="364" name="Moodz_Flash" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>
I hope this makes sense, and I'd love someone to tell me I'm being an idiot. Thanks for your time.
Francis Lillie
Clipping Half-characters From Edge Of Textfield
I have a TextField that contains many more characters than it has width for. I have created a tickertape effect by deleting the first letter every 1/3 of a second.
My problem is that there are often part-letters visible on the right hand edge of the textfield that are only half in the text box. Is there any way to set a TextField to resize to allow only whole letters?
Eps Into Flash8 From Freehand Ignores Clipping Path
Hi,
Flash8 is seeing vector lines beyond the clipping path when its exported as an eps from Freehand9 or MX.
I have a map with roads etc drawn in FH9, I have placed a box over that part of the map I wish to export as eps and cut contents then paste inside box. I now see just the map within the box. Export as eps. (I do this all the time). Open it into photoshop, it sees just out as far as the box border. No problem
However File >Import to Library in Flash 8 , then drag drop to stage, sees all the artwork outside of the box, stuff I don't want. No difference if exported as eps from MX. Trimming hundreds of roads etc down to the edge of the box is impractical for every eps I need to make, as I need to export each bus route on the map as a separate eps, and there are many !
Envirographics
Flex Lame Question About Stage Clipping
Hi there,
First of all, I must say this is a very useful forum and browsing thru the threads helped me a lot. This is the 1st time I post here. I couldn't find the answer to my question, maybe one knows an easy solution.
The problem is, I have some sprites on my stage, and I want them to clip once they're out of the area (should be 550x400 in my case). I am using Flex, so I thought the compiler option -default-size 550 400 must be enough. After this, I've tried trace(stage.stageWidth) and the result is 1600.
Something tells me that I'm maybe totally wrong assuming that I need to manipulate the stage object. I have a complex solution (draw to a back buffer and flip it on each new frame) but thought maybe someone could show me the easier & more correct way.
Here it goes: how do I make my sprites & everything clip outside the 550x400 area?
Thank you in advance
Drop-shadowed Text Clipping In Flash Player 9
I recently created an animated menu in Flash that used some manually tweened text (letter spacing tween) and had a drop shadow effect applied to it. It worked fine as long as I had version 8 of the Flash Player installed. Once version was installed, the text became clipped as it was animated. Investigating the problem, I removed the drop shadow effect and lo and behold, the problem was gone.
I googled the problem and nothing turned up. It doesn't seemed to be listed by Adobe as an issue. Is this a bug or am I the victim of bad Flash design practices.
I've uploaded both files to our server in case anyone wants to take a peak:
flash_menu.zip
Alvin
Edited: 04/24/2007 at 08:34:52 AM by aubiera
Flash Problem: Weird Clipping On Widow Size
http://www.nevillefrench.com/nf_flash.html
If have a look at that link you'll notice that if your window is smaller than 1024 by 768 you'll notice the content moves away from the viewable area. It looses the content from the middle out depending on window size.
The page uses the swfobject.js to active flash 8 properly. And its width and height are scaled 100%. The whole page is flash including the background.
Need know know how to fix that disappearing content problem. Any advice would be great.
Thanks
|