ActionScript 2.0 :: Hittest Nor Other Method Doesn't Work
Aug 20, 2010
So I'm doing this project for school and all, and I'm trying to do a htitest on an object. For some reason, it doesn't work. So I tried writing out my own method... Which halff worked, but wasn't as exact as it should've been.
Heres my code (Though I'm pretty sure somethings wrong with my MC, so i'll upload the main .fla file)
Code:
right = true;
left = false;
itemX;
itemY;
[Code].....
View 1 Replies
Similar Posts:
Dec 30, 2008
I have this code so that when a spaceship goes through a blackhole it plays the spaceships moveiclip. This works fine on the first part of the code when the user just clicks the start button.However, i have put in a difficulty setting and when you change the difficulty setting the hittest doesn't work anymoreand there are no error messages. I have tried putting the blackHoles array in the difficulty function but nothing changes and i didn't really think this would make a difference as the easy function is already using the blackHoles array outside the difficulty function.
View 7 Replies
Sep 13, 2009
I have about 100 movieclips that scroll across the stage from out of bounds. They are supposed to hit another movieclip both in bounds and out of bounds, but it seems like Flash only detects the hittest when it happens within the frame.
if(_root.sceneclip.reef1.hitTest(this._x+300, this._y+350, true) ){
View 2 Replies
Oct 29, 2006
I have two pieces of code, that won't work together.First: this makes a hitTest on an mc to make it run on rollover:
Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
if (this._currentframe<this._totalframes) {
nextFrame();
[Code]...
Each work seperately, but they won't together. How do I get around this?
View 7 Replies
May 8, 2010
I wonder is anyone can look at this code and tell me why calling the removeSelectedChild works when called from the same document, but returns the following error when called from the child document/component.
"ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller."
<?xml version="1.0" encoding="utf-8"?>
[Code]...
View 3 Replies
May 19, 2010
This movie is supposed to start on a random frame, but the code seems to get ignored in Firefox. I also have some weird behavior when i test it locally, but it works fine in IE8, Safari, and Chrome: [URL]
Here is the code:
i = Math.floor(Math.random()*3385);
gotoAndPlay(i);
//trace("Current Frame: "+this._currentframe);
The .fla can be downloaded here: [URL]
View 3 Replies
Oct 14, 2011
I am using the below package to play back a wav file. In my main file I create several of these objects, put them in an array, and then try to call
playBack().
Unfortunately it doesn't work. However, I can call playBack() from within the object, for example by having this object create a button.
Code:
package
import flash.display.Sprite;
import flash.net.URLLoader;
[Code]....
View 2 Replies
Aug 12, 2010
I've got on main timeline (on frame 10) buttons, when I click one of them it goes to its currentLabel"". On curerntLabel at frame20 "racerButton" where I've got some tweening. At currentLabel "boardButton" at frame30 I load external swf. The problem I've got is when I press any button everything works fine. But when I first press button "boardButton" at frame30 the ext.swf shows up fine, but when next I click the button "racerButton" at frame20 the tweening doesn't work there and it gives me error
[Code]....
View 1 Replies
Jul 21, 2011
I have a drag and drop game. You listen to a sound for exampl "bread" You proceed to drag that mc to a box. If it is the right object I want to remove that mc and splice the array so it doesn't choose that object anymore. However I have notices two things.
When I splice(0) a specific element - then nothing works. When I splice the cuurent indexed element ie: the last element to get right - it doesn't actually remove it from the array. I have highlighted the key code parts.
[Code]....
View 3 Replies
Jul 27, 2010
I'm having a problem with the flash publish method and swfaddres.I've included the javascript of the flash pubblication in a new javascript file with the swfaddress in the same page.If i use swfobject for including my flash file in the swf, swfaddress works ok...if i include the swf with the flash method swfaddress doesn't work.Here the link: http:[url]......
View 0 Replies
Jun 12, 2009
how do I use switch method with hitTest?
In this case I want to use the hitTest with the same intent of the _droptarget:
Code:
on (release) {
switch (_root.object6.hitTest) {
case _root.jogo.labirinto.fenda_MC :
[Code]....
how I use swtich with hitTest or the correct way to tell the program the path to drop the object in its target.
View 1 Replies
Oct 16, 2009
I decided to try to use setInterval for myanimation, which is just a mouse trail.However, I'm trying to get teh mouse trail to be a dynamic mask.In my previous swf this was achieved by using a holder mc with the animation inside and then using this as the mask. But this time I just canpt seem to hit on the right way to get it to work. The code I am using for the mouse trail is:
Code:
var i:Number = 0;
var myInt:Number;
var t:MovieClip;[code].....
in the function, but now the trail doesn't resize and the mask still doesn't work.
View 1 Replies
Mar 17, 2011
I am trying to create a game. My game is birds eye view game and I am trying to get it so my character (instance name hero_mc )can't pass through the buildings(instance name block_mc). I have been looking at tutorials on the web and most of them cover it so that a text appears if you hit the object whereas I want it so my character can't pass through or well is "push back", the one tutorial I found doesn't want to work for me, but it's not giving me any errors so I really don't know what is wrong with it.
Actionscript Code:
hero_mc.addEventListener(Event.ENTER_FRAME, enter_frame); function enter_frame(event:Event):void{if (hero_mc.hitTestObject(block_mc)) { trace("hero _mc is next to block_mc") } else { hero_mc.y += 10 hero_mc.x += 10 } }
My character still passes through the block objects.
View 1 Replies
Mar 30, 2010
I have this very simple .fla file and you use the keys to move the bus around. As it detects the hittests with the other movie clips on the stage it goes to and plays a frame on that mc's movieclip. It all works fine but i dont want the hittest to repeat after it has done it once(on each movie clip) so that as you drive the bus around you reveal the photo. [URL]
View 1 Replies
Sep 3, 2005
so my game's code is as follows:
Code:
//The Austin Weisgrau (El Nacho)
//Blob Game, to go with the video so it will get like the .3 mor it needs not to be blammed
[Code]....
the character instance is Blob and the background instance is Background. i can't get the hitTest to work with either of those two things in the /* */ and i need to no how i can
View 1 Replies
Oct 14, 2008
For some reason I cannot get my hitTest to work on an mc within an mc within an mc...which is assigned to a variable...
Code:
var miniWin:MovieClip = CAD_mc_mini.zoomControl.miniWin;
trace(miniWin); //returns _level0.CAD_mc_mini.zoomControl.miniWin
var mouseListener: Object = new Object();
[Code].....
View 3 Replies
Sep 22, 2009
I was trying to make it so you had to hold up this ball, and if it touched the block near the bottom of the screen, it would go to the first keyframe. (The menu.) So, I labeled the ball, "ball", and the block, "block". Then, I added this code to the block:
onClipEvent (enterFrame) {
if (ball.hitTest(block)){
gotoAndPlay(1)[code]....
And tested it out. To my dismay, it didn't work at all. I've spent about 30 minutes testing other ways, and I cant seem to make it work.
View 6 Replies
Sep 23, 2009
import flash.display.BitmapData;
import flash.geom.Point;
//
var BitmapA:BitmapData = new BitmapData(550, 400, true, 0x00);
[code]....
This is using the bitmapdata.hittest way to check whether the one bitmap is overlapping the other. Throug pixel-to-pixel detection.But I'm having trouble understanding this line:
Code:
if (BitmapA.hitTest(destPoint, 255, BitmapB, currPoint, 255))
I know that destPoint is the topleft point from which it is determining all opaque pixels. No value is given to destPoint so basically it is checking from 0,0. Having determined all opaque pixels from that bitmap it should compare them with the opaque pixels of the other bitmap. But why does currPoint use the topleft coordinate of its movieclip? Couldn't it just as well use 0,0 too? I mean when determining the opaque pixels of bitmap two it might as well start checking for those from 0,0 as the topleft position as well?
View 2 Replies
Mar 28, 2011
i am making a game where a ninja runs through a course, every thing is running smoothly. EXCEPT hittest will not work, hittest never works on ANY of my projects. I know im doing it right, because ive even tried copying and pasting working ones. Look at the attached fla file to see what im talking about.is it my computer that wont let it work, because the exact codes worked for all of the people on youtube that used it.
View 2 Replies
Feb 18, 2009
I am trying to use the following code to simplify multiple Hittests using an Array, but the code won't work. Can anyone tell me why?
var blockArray:Array = new Array("block1", "block2", "block3");
player.addEventListener(Event.ENTER_FRAME, blockTest);
function blockTest(evt:Event):void {
[Code].....
View 4 Replies
Mar 1, 2005
I'm having a problem with my dragOver function.The point of my project is that can drag the items that are on the table to the little bag (this is a button) on the left bottom of the screen.The thing is that the dragging works but when I perform a hitTest the item is supposed to dissapear, but it doesn't....
View 3 Replies
Apr 21, 2010
I have a button object that I need to scale to align with the variable width of an array of images.However, when I set the width in code, the button does not actually become that width. Tracing out the width gives me the correct value, but on screen.. it's off.
I've proved it to myself by scaling the same button object manually in the properties pane and visually comparing. Both of the buttons below have a width of 410.
Code:
navigatorDown_btn.width = 410;
navigatorDown_btn.x = (stage.stageWidth/2)-(navigatorDown_btn.width/2);
trace(navigatorDown_btn.width); // output: 410
View 4 Replies
Nov 30, 2009
I am having trouble getting a hitTest to work. My two MCs are lines, one horizontal, one slanted. When the horizontal line gets within the "bounding box" of the slanted line the hitTest is true, but it's not touching the slanted line yet. I saw that the shapeFlag property comes into play here, but only when using coordinates... I'm not sure how to apply it to these two lines. I want the hitTest to be true only when the lines actually touch. I have attached a simple FLA of the problem.
View 1 Replies
Sep 6, 2011
Lets say that I got movieclips A,B,C,D in my scene and E,F which only come into scene when A hitTest B and C hitTest D.I was able to make the A+B and C+D hitTest functioning properly. But when E,F came into the scene, I tried to make E to hitTest F to get something else function but they won't work.# note that there is some short animation before E & F come into scene.I am pretty sure all the instance names are named properly.
View 5 Replies
Mar 19, 2009
I've been trying to write a hittest that will work for rounded walls on my RPG. But I've been epic phailing.
Heres my code:
onClipEvent(load){speed=10;
}onClipEvent(enterFrame){if(Key.isDown(Key.UP)){this._y-=speed;this.gotoAndStop(5);
}if(Key.isDown(Key.DOWN)){this._y+=speed;
this.gotoAndStop(6);}
if(Key.isDo wn(Key.RIGHT)){this._x+=speed;this.gotoAndStop(7);
}if(Key.isDown(Key.LEFT)){this._x-=speed;this.gotoAndStop(8);}
View 2 Replies
Nov 10, 2003
for some reason the hitTest I have setup in the attached file seems to work in relation with the blue box's that surround objects and not with the actually objects. Anyways I'm pretty sure that it has to do with the border.
View 4 Replies
Apr 7, 2010
when I try to compile project, there are many errors like : Method _get__ON_WIDGET_DESTORY_ONLINE doesn't exist (or any other __get__* name).These lines from AS file, where error is described:
Code:
static function get ON_WIDGET_DESTORY_ONLINE() {
return ("onWidgetDestoryOnline");
[code]......
View 0 Replies
Aug 11, 2010
I'm trying to get the id3 information from an mp3 being streamed from FMS.I followed the samples I found online and am using the following client-[code]As a note the above code works fine to play the actual file (substituting mp3: for id3:, of course) it just doesn't seem to trigger the onID3 method (I've tried onId3 which is what the samples use).I am also able to view the id3 information from windows explorer and other external readers.The platform I'm ultimately targeting is Flash Lite 3.1 AS2, but I've tried various configurations and haven't had any success.
View 1 Replies
Mar 20, 2011
As URLLoader launches requests without any issue (I'm monitoring network and flash activities via FireBug in FF 3.6.13), the FileReference upload method doesn't. The odd thing is that no error is thrown AND (the strangiest) the complete and the progress events are correctly fired while no request has been done, and my php isn't receiving anything !
ActionScript Code:
var file:FileReference = new FileReference();
function mClick(mEvt:MouseEvent):void {
[code]...
View 2 Replies
Dec 30, 2009
I have a problem with the getCharBoundaries method of a textField, it doesn't return the correct rectangle for me. To show the problem I put a long text in a textfield and highlighted the rectangle returned by getCharBoundaries for every second character. Here is my code:
[Code]...
View 5 Replies