Detecting When Actual Content Of MC Collides With Other
Mar 31, 2009
I've been messing around with hittest and I can't figure out how to detect when the actual content of the MC collides with the other's, rather than just detecting when the bounding boxes collide.
View 3 Replies
Similar Posts:
Jan 15, 2009
I have a problem with scrolling content.I m using the information and files from the following tutorial...http:[url].....The scroller is working but I cant see the actual content.I cant figure out what the problem is, I�ve uploaded the .fla file so that you can check it out...http:[url]......
View 2 Replies
Nov 9, 2011
I was wondering if there is a way to make the actual stage dynamic to the content loaded in the flash file.
Firstly the method I am using is importing a external swf to the stage into a container called container. The main stage, lets call it index, is still on default size, and I want this to expand dynamically as content is loaded in. page1 may be 900px width, page2 may be 500px width, and as I load the content the index stage should expand the width to that of the page loaded. Some steps I have tried but did not work.
if page1 button is pressed stage.stageHeight = 900; - not working (how do I set stage size in as3)made a movieclip in page 1 spanning the page size and called it p1_stage so I can reference the data from there. trace(container.p1_stage.height); gives this error: TypeError: Error #1010: A term is undefined and has no properties. at index_fla::MainTimeline/frame1()
View 3 Replies
Sep 23, 2009
I want to load in a SWF and set it to fit in the window, whilst keeping it's aspect ratio.When I do this by setting the height and width of the SWFLoader, the SWF will resize to best fit in the space (as it is keeping it's aspect ratio).However I can't find a way to detect the height and width of that SWF now it has been resized. The size of the SWFLoader reflects what I set it to, and the SWFLoader.LoaderInfo size seems to be totally random.
I have also tried the loaderInfo.content, but again I don't get a value that compares to the size of the SWF I have loaded (or at lease the size of what is visible).The only thing I can think to do is to know the height and width before and then figure out the aspect ratio, so if I resize the width to 50% of the window, I can do the maths on the height to make the swf loader the same height as it's scaled content.
View 1 Replies
Oct 12, 2009
What event would signal that the visual content of an SWFLoader had changed or how would you detect that.
Actually if the visual content changes there is in fact a "render" event broadcast in the parent application, but I don't know how to determine which SWFLoader caused it.
Say you have one SWFLoader on a page that contains some sort of input control but its just sitting there doing nothing until a user presses something on it, and then there is a render event in the parent application. However, if there is another SWFLoader that contains a continually playing VideoDisplay, then there will be continal render messages being broadcast in the parent application (I verified this.) My point being that the parent application is getting signaled somehow the instant the visual content of some embedded SWFLoader changes. But the question is how does my code determine specifically which SWFLoader changed.
View 2 Replies
Sep 2, 2009
I have a Card class. From this class, I have three possible children: Photo, Video and Info. In my main class, I want to create a few instances of these different classes without knowing what kind it is. But, no matter that, I want them all to listen to the mouse, so I may have something like this:
ActionScript Code:
var item:Card = new Photo();
item.addEventListener(MouseEvent.CLICK, mouseHandler);
The thing is: the Card class is kinda like a canvas... it has certain properties common to every type of item, but there's a space where it leaves it as a canvas... a Photo instance will load a photo there, a Video instance will load a video and a Info instance will load text to a TextField. The problem is that the event listener doesn't work the way I want it to... on an Info instance, the target of the click is the TextField; on a Photo instance is the picture... I want them all to be the class itself... in other words, I want to be able to parse the target as a child of the Card class. My code for the mouseHandler method is
ActionScript Code:
private function mouseHandler(e:MouseEvent):void
{
if(e.target is Photo)
[Code].....
That's the main idea... to be able to know what kind of object I'm clicking and access its properties... but on an Info instance, e.target is of type TextField... to be able to access the Info object, I have to do e.target.parent, and that is NOT the idea.
View 1 Replies
Mar 15, 2011
I have a dynamic TextField set as input field. I listen for the FOCUS_IN and FOCUS_OUT events to enable black border and grey background when the user clicks on that text field and remove them when the text field loses its focus - when the user clicks on the stage or any other element.
That works perfect until I drag any of the Flash components on the stage. In order to lose the focus from the text filed I need to click on a component otherwise it won't work. It looks like components "steal" focus out event...
ActionScript Code:
import flash.events.FocusEvent;
inputField_txt.addEventListener(FocusEvent.FOCUS_IN, onFocusIn);
[Code].....
View 0 Replies
Mar 4, 2010
_root.createEmptyMovieClip("vsound",_root.getNextHighestDepth())vSound.attachAudio(ns);[code]....
Before i had the volume slider, the mute button was fine. but now, it doesn't work anymore.
View 1 Replies
Nov 9, 2011
I am developing a game with Flixel as a base, and part of what I need is a way to check for collisions along a line (a line from point A to point B, specifically). Best way to explain this is I have a laser beam shooting from one ship to another object (or to a point in space if nothing is overlapping the line). I want the line to reach only until it hits an object. How can I determine mathematically / programatically where along a line the line is running into an object?
I could try measuring the length of the line and checking points for collision until one does, but that seems like way too much overhead to do every frame when I'm sure there is a mathematical way to determine it.
Edit: Before checking an object for collision with the line itself, I would first eliminate any objects not within the line's bounding box - defined by the x of the left-most point, the y of the top-most point, the x of the right-most point, and the y of the bottom-most point. This will limit line-collision checks to a few objects.
Edit again: My question seems to still not be fully clear, sorry. Some of the solutions would probably work, but I'm looking for a simple, preferably mathematical solution. And when I say "rectangle" I mean one whose sides are locked to the x and y axis, not a rotatable rectangle. So a line is not a rectangle of width 0 unless it's at 90 or -90 degrees (assuming 0 degrees points to the right of the screen).
View 4 Replies
Jun 8, 2010
hi does anybody know how to make gravity invert or flip when a mc collides with a box?
View 1 Replies
Dec 5, 2010
i want to use a DisplayObject to determine collides with hitTestObject function how to create a DisplayObject for BitmapData? so it knows totally transparent pixels are not collidable
View 2 Replies
Mar 26, 2011
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.
View 1 Replies
Mar 26, 2011
My problem is with score counting, i have a score field, a main character and 5 coins.When the character collides with the coin the following happens:1. The coin disappears (Supposed to happen)2. Adds 1 point to the score (doesn't work the way it should)What happens is (i have set the score field to start at 0 with (_root.score = 0 this for some reason doesn't have any affect.Only the first coin to be hit adds (1) to the score, after hitting a second it completely disappears. Also have it set so that if the score goes to 5, the door in the top left will open. (NOTE: for some reason this seems to work, if you "collect" all the coins the door will open, but the SCORE field doesn't show the number)
View 1 Replies
Jun 22, 2005
i am making a pacman game, and i need to know how to make it go to a certain scence when a movie clip collides with another movie clip.
View 2 Replies
Apr 8, 2011
I am trying to get the stage width of the FLA in as3. Obviously, stage.stageWidth works well, the only issue is that when viewing the the SWF in an HTML page when you are zoomed in or out it gives you the relative width of your current view. For example, my stage width is 800x600 and when I trace out the stage.stageWidth it is showing up as 800 as long as I am viewing in my browser at 100 percecent, but once I zoom out in my browser the stageWidth gets traced out as a smaller number. Does anyone know how I can dynamically get the stageWidth of the FLA and have it not change regardless of how you are viewing the HTML page
View 1 Replies
Nov 13, 2002
When my Movie Clip "Fire" collides with the MC "Wall" i want the variable "Points" to increase by one. And not as in
if (_root.fire._y == _root.wall._y && _root.fire._x == _root.wall._x) {
_root.points++
}
Because then they have to be on the exact same coordinates. Wall, however, is a pretty long Mc and i want the same thing to happen no matter where the fire hits it
View 2 Replies
Jan 7, 2009
I am trying to retrieve my SWF's referring document filename. For example, if index.html is calling mymovie.swf, I want to return index.html. I know this can be done through a combination of scripting and flashVars, but I would like to avoid that for security purposes. The flashVars variables can be seen by anyone who knows how to view source. Is there a way to accomplish this solely in Actionscript? or Flex?
View 10 Replies
Jan 23, 2008
[URL]Basically, I would like to have an xml gallery, grid alignment... and to be able to use an actual scrollbar to look through the thumbnails.I tried to do this at home but got weird results, IE when scrolling down the thumbnails would actually scroll up etc.
View 6 Replies
Aug 3, 2011
I have converted my MPEG video recorded from my camcorder to FLV to use on "Flash CS4" using "Adobe Media Converter". But the FLV playback on the "Flash player 10" is alot smaller than the playback of the MPEG video on "VLC". Is there anyway to adjust any properties to get the FLV to the actual size of the MPEG video?
View 1 Replies
Oct 28, 2009
increase the actual workspace. Not the size of my stage but the actual box that is around the stage. Mines a light gray. Its just I have stuff the needs to be way way off screen and there seems to be a limit on how far the project extends.
View 2 Replies
Dec 21, 2009
I like to know is "where, exactly, are you drawing that glyph?" The TextField class provides the methods getBounds and getCharBoundaries, but these methods return rectangles that extend far beyond the actual bounds of the whole text object or the individual character, respectively.
var b:Sprite = new Sprite();
b.graphics.lineStyle(1,0xFF0000);
var r:Rectangle = text.getCharBoundaries(4);
[Code].....
Is there any way to get more precise information about the actual visual bounds of text glyphs in ActionScript?
View 3 Replies
Jan 19, 2011
I'd like to get the actual height of a component after adding some children.
When inspecting the variables tab in debug mode, I see 2 different height variables:$height (which contains the correct value: 138) and height/_height (which contains a wrong value: 10).
I guess that the display is not updated and so I'm not getting the correct height using component.height, but how can I get the value in $height?
[Code]...
View 2 Replies
Aug 26, 2003
how you can pause an actionscript code? I've found posts which explain how to pause animations, but none on how to pause actual actionscript commands .A quick example would be to make a box increase in size (which was done through AS). But when it gets to 100 pixels wide, i want it to pause for 3 seconds before continuing again.
View 7 Replies
Oct 27, 2010
I've added a UIScrollBar on a text. What I need is to make the actual bar to be on bottom on default. (for chat text purposes.. new messages will be added on bot)
View 1 Replies
Nov 4, 2010
Is there any way to access the actual FLV object or whatever format YouTube videos are streamed in so you could load it in normally and play it like any netstream?
View 6 Replies
Nov 13, 2007
I've decided to take the jump to AS3 now but im having a lot of issues... Im trying to load an external swf into a movieclip.
In AS2 it would be:
PHP Code:
var mcLoader:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object ();
mcLoader.addListener(myListener);
mcLoader.loadClip("mainLoader.swf","externalLoader_mc");
[Code].....
How can i load the URLRequest into an actual movieclip as i have done in AS2? As far as i know the load function only accepts one variable. ATM the external swf im loading is just going into thin air and i can't get anything to happen (i have the functions created to deal with the events btw).
Edit: Just fixed it by adding externalLoader_mc.addChild(myLoader);
View 10 Replies
May 5, 2010
I don't really use Flash, but was just trying to put up a little video demo online.
Just dragged the video onto the canvas, published it as an .swf, but when I upload it all and visit the web page, the video clip / swf isn't displaying.
Its fine in the preview though.
The page is here :
[URL]
View 7 Replies
Jul 12, 2011
How does one actually go about writing a file out to a directory from inside a class or is there an actual class that handles that like in other languages?
View 14 Replies
Dec 17, 2009
I'm trying to implement a dragging system which can only be described as similar to dragging the map on Google Maps. I can set up dragging easily in Flex, but unfortunately the standard model of dragging i.e. dragging an element proxy and dropping it in another element is not what I'm after.
Is there anything built into flex where the actual element rather than a proxy can be repositioned in a different place within the same parent? Or will I have to hand code something using mouse events as you would if implementing a solution in JavaScript?
View 2 Replies
May 7, 2010
I wahnt to place a container (alpha red) on top of my chart like on the image.How to get the x, y (point A), width, height of this area?
View 1 Replies