Hittest Not Working
This is my code it is not working
on (keyPress "<Left>") {
currentX = this._x;
this._x = currentX - 5;
if(this.hitTest(_root.leftbord)) { this._y++; }
on (keyPress "<Right>") {
currentX = this._x;
this._x = currentX + 5;
if(this.hitTest(_root.rightbord)) { this._y--; }
that's what you've coded: when you're using the left key and hit "this", you move to the left and when using the right key, you move to the right.
if you want to rebound use:
on (keyPress "<Left>") {
currentX = this._x;
this._x = currentX + 5;
if(this.hitTest(_root.leftbord)) { this._y++; }
on (keyPress "<Right>") {
currentX = this._x;
this._x = currentX - 5;
if(this.hitTest(_root.rightbord)) { this._y--; }
Similar Messages
-
HitTest not working as it should
Hello, I am currently working on a game as a project for my
website. It's style is based after asteroids with a few similar and
different features. I have most of the scripting done, but I am
having problems with one part. I need help with my hitTest with my
bullets. All my actionscript is on the main timeline and is
together. It all works except the part in bold, which is the bullet
hitTests.
quote:
stop();
//Bullet scripts
["Bullet"+Num]onEnterFrame = function() {
if(enemy.hitTest(this)){
enemy._x-=40;
enemy._y-=40;
//enemy scripts
enemy.onEnterFrame = function() {
if(this._x<hero._x){
this._x+=2;
if(this._x>hero._x){
this._x-=2;
if(this._y<hero._y){
this._y+=2;
if(this._y>hero._y){
this._y-=2;
//hero scripts
Num = 0;
hero.onEnterFrame = function() {
//movement script
if(Key.isDown(Key.LEFT) || Key.isDown(65)){
this._x-=4;
if(Key.isDown(Key.RIGHT) || Key.isDown(68)){
this._x+=4;
if(Key.isDown(Key.UP) || Key.isDown(87)){
this._y-=4;
if(Key.isDown(Key.DOWN) || Key.isDown(83)){
this._y+=4;
//angle script
var x:Number = _xmouse-this._x;
var y:Number = _ymouse-this._y;
var angleRad:Number = Math.atan2(y, x);
var angleDeg:Number = angleRad/Math.PI*180;
this._rotation = angleDeg;
ShootBullet = function () {
var Bullet = _root.attachMovie("Bullet", "Bullet"+Num,
_root.getNextHighestDepth());
var point = {x:this.hero.gunTip._x,y:this.hero.gunTip.
_y};
this.hero.localToGlobal(point);
Bullet._x = point.x;
Bullet._y = point.y;
Bullet._rotation = _root.hero._rotation;
Bullet.onEnterFrame = function() {
Bullet._x += Math.cos(Bullet._rotation*(Math.PI/180))*2
5;
Bullet._y += Math.sin(Bullet._rotation*(Math.PI/180))*2
5;
Num++;
hero.onMouseDown = function() {
ShootBullet();
The problem here is that it is doing the
enemy._x-=40;
enemy._y-=40;
part from the very start. So as the movie/game starts the
enemy is already doing the actions as though the bullet was
covering the enemy at all times.
For the
fla.
file,
click
here.
To view the
swf,
click here
You can also find out how I created the file in 7 easy steps
here.hitTest works fine, it's the *developer* that's broken ;)
What you are trying to do there is a bit confused. This:
["Bullet"+Num]onEnterFrame = function() {
if(enemy.hitTest(this)){
enemy._x-=40;
enemy._y-=40;
has several problems. It should be:
this["Bullet"+Num].onEnterFrame = function() {
if(this._parent.enemy.hitTest(this)){
this._parent.enemy._x-=40;
this._parent.enemy._y-=40;
**BUT** you are already assigning each bullet an enterFrame
handler to
create it's moviement. Doing this will replace that handler,
as any object
can only have a single enterFrame handler at a time. So, this
works:
ShootBullet = function () {
var Bullet = _root.attachMovie("Bullet", "Bullet"+Num,
_root.getNextHighestDepth());
var point = {x:this.hero.gunTip._x, y:this.hero.gunTip._y};
this.hero.localToGlobal(point);
Bullet._x = point.x;
Bullet._y = point.y;
Bullet._rotation = _root.hero._rotation;
Bullet.onEnterFrame = function() {
Bullet._x += Math.cos(Bullet._rotation*(Math.PI/180))*25;
Bullet._y += Math.sin(Bullet._rotation*(Math.PI/180))*25;
if (Bullet._parent.enemy.hitTest(Bullet)) {
Bullet._parent.enemy._x -= 40;
Bullet._parent.enemy._y -= 40;
Num++;
You are also going to need to create code to remove each
bullet once it has
hit the enemy or left the screen, or else your game will
rapidly slow to an
unplayeable crawl...
ShootBullet = function () {
var Bullet = _root.attachMovie("Bullet", "Bullet"+Num,
_root.getNextHighestDepth());
var point = {x:this.hero.gunTip._x, y:this.hero.gunTip._y};
this.hero.localToGlobal(point);
Bullet._x = point.x;
Bullet._y = point.y;
Bullet._rotation = _root.hero._rotation;
Bullet.onEnterFrame = function() {
Bullet._x += Math.cos(Bullet._rotation*(Math.PI/180))*25;
Bullet._y += Math.sin(Bullet._rotation*(Math.PI/180))*25;
if (Bullet._parent.enemy.hitTest(Bullet)) {
Bullet._parent.enemy._x -= 40;
Bullet._parent.enemy._y -= 40;
removeMovieClip(Bullet);
if (Bullet._x<0 || Bullet._x>Stage.width ||
Bullet._y<0 ||
Bullet._y>Stage.height) {
removeMovieClip(Bullet);
Num++;
In addition, instead of
Bullet._parent.enemy._x -= 40;
Bullet._parent.enemy._y -= 40;
You need to move the enemy in relation to the bullet's
vector. Otherwise, if
i fly to the top left of the enemy then shoot it, it bounces
in to me....
Remove '_spamkiller_' to mail -
Button within a movie clip not working
Hiya,
I have a movie clip within my swf website that is basically
an icon that you roll over to produce the menu. The movie clip has
coding inside it to produce the rollover effect. This is as
follows:
stop();
this.onEnterFrame = function(){
if(rewind == true){
prevFrame();
this.onRollOver = function(){
rewind = false;
play();
this.onRollOut = function(){
rewind = true;
Whilst this coding works fine for this movie clip, for some
reason the buttons within the movie clip that appear as you
rollover them will not work when pressed. I am trying to get them
to navigate the main timeline, i.e. coding as follows:
on (release) {
_parent.gotoAndPlay("home")
_parent should be correct, I've tried it without and with
_parent._parent however still it has no effect. From what I can see
everything should be working fine.
Is there some reason why buttons will not work within this
sort of roll over effect movie clip?
Thanks for your help.you can't assign mouse handlers to a parent movieclip and
expect a child movieclip to respond to mouse events: the parent
will intercept those events.
to remedy, either assign all your mouse handlers on the child
generation movieclips or use a hitTest() for one of the
generations. -
Embeded Flash player not working
I have a browser-based app that we are considering porting to
AIR. The basic functionality of the app uses AJAX to pull down a
list of videos to be displayed, then plays the video when it is
selected. The browser-based app uses Quicktime videos, which I have
come to learn won't work in AIR, so I'm trying to switch to a Flash
player.
My problem is that for the life of me, I cannot get AIR to
play the video. I created the player in Flash, and everything works
great there, as well as in any browser I can find. When I load in
AIR, I see the player, but playback never starts. My
application.xml file is very simple:
quote:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="
http://ns.adobe.com/air/application/1.0"
version="1.0">
<id>test</id>
<version>0.1</version>
<name>test</name>
<filename>test</filename>
<initialWindow>
<content>intro2.html</content>
<visible>true</visible>
<maximizable>true</maximizable>
<minimizable>true</minimizable>
<width>1100</width>
<height>1000</height>
</initialWindow>
</application>
and my page is also quite bland:
quote:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Demo</title>
<script type="text/javascript" language="JavaScript"
src="AIRAliases.js"></script>
</head>
<body>
<object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
width="857" height="484" id="airPlayer" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="airPlayer.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="airPlayer.swf" quality="high"
bgcolor="#ffffff" width="857" height="484" name="airPlayer"
align="middle" allowScriptAccess="sameDomain"
allowFullScreen="false" type="application/x-shockwave-flash"
pluginspage="
http://www.macromedia.com/go/getflashplayer"
/>
</object>
</body>
</html>
My xml file, intro2.html, airPlayer.swf and
intro.flv are all in the same directory. Any advice would be
appreciated.Hi Conrad!
As you have no doubt already realized, using the Learning
Interaction templates that are available in Flash MX / MX2004 and 8
will not work at all in Presenter content.
The coding methods conflict while playing back within the
Breeze environment and I
think it has to do with the _dropTarget property as part of
the interaction's codebase. The _dropTarget method is NOT supported
in Breeze, but the hitTest() method IS!
I have written a few drag and drop exercises that do work
within Breeze content, and you have to use the hitTest() method to
accomplish it.
As you already have discovered, the bottom line is that the
learning components were intended to be "stand alone" objects that
could be incorporated into a web page (or even a CD as these
objects are nothing more than swf files). Aside from the fact that
the prebuilt/preconfigured learning objects in flash don't always
work in Breeze, in my mind, the bigger question here is the ability
(or more accurately) the inability to connect these SCO's to an LMS
for tracking. As stand alone objects, they're actually pretty
handy...but not in Breeze.
I realize this doesn't help much with what you're trying to
do, but from my perspective, you're better off creating your own
drag n' drops.
I've got a bunch of examples to share if you'd like to take a
look...just send me a PM or email if you're interested.
Rob
[email protected] -
Embeded Flash component not working
I have createdf a Flash movie using the Drag & Drop
Learning Interactions Component using Flash MX 2004. The
interaction works fine as standalone Flash movie but when embedded
in an Adobe Presenter presentation, the drag works ok but it will
not drop the object. I have had the Breeze control the Flash movie
and also Breeze not control the movie.
Any ideas?Hi Conrad!
As you have no doubt already realized, using the Learning
Interaction templates that are available in Flash MX / MX2004 and 8
will not work at all in Presenter content.
The coding methods conflict while playing back within the
Breeze environment and I
think it has to do with the _dropTarget property as part of
the interaction's codebase. The _dropTarget method is NOT supported
in Breeze, but the hitTest() method IS!
I have written a few drag and drop exercises that do work
within Breeze content, and you have to use the hitTest() method to
accomplish it.
As you already have discovered, the bottom line is that the
learning components were intended to be "stand alone" objects that
could be incorporated into a web page (or even a CD as these
objects are nothing more than swf files). Aside from the fact that
the prebuilt/preconfigured learning objects in flash don't always
work in Breeze, in my mind, the bigger question here is the ability
(or more accurately) the inability to connect these SCO's to an LMS
for tracking. As stand alone objects, they're actually pretty
handy...but not in Breeze.
I realize this doesn't help much with what you're trying to
do, but from my perspective, you're better off creating your own
drag n' drops.
I've got a bunch of examples to share if you'd like to take a
look...just send me a PM or email if you're interested.
Rob
[email protected] -
Not work tablet UI on Prestigio 5080 PRO tablet
I read that browser.ui.layout.tablet = "1" can fix this problem. But it not works. I can work only in pnone interface that is not good for my 8'' tablet.
Would it be possible for you to share the problematic pdf and OS information with us at [email protected] so that we may investigate?
Thanks,
Adobe Reader Team -
Why self-defined access sequences of free goods can not work?
Hi gurus,
I have maintained access sequences of free goods self-defined.but when i creat the SO it does not work!
when i used the standard access sequences ,it is OK .
Can anybody tell me why?
thanks in advanceDear Sandy,
Go to V/N1 transaction select your self defined access sequence then go in to the accesses and fields and check all fields are activated.
Make sure that these fields are flowing in your sales order.
I hope this will help you,
Regards,
Murali. -
Adobe bridge raw not working with windows vista in photoshop cc, why?
adobe bridge raw not working in photoshop cc, is there a fix?
Your sure your using photoshop cc on windows vista?
I was under the impression that photoshop cc would not even install on windows vista.
What version of camera raw do you have?
In photoshop under Help>About Plugin does it list Camera Raw and if so which version is it?
(click on the words Camera Raw to see the version)
Camera raw doesn't work if it's a camera raw file or some other file type such as jpeg or tif?
What camera are the camera raw files from?
Officially camera raw 8.3 is the latest version of camera raw that will work on windows vista. -
Adobe Bridge CS5 in windows 7 not working?
Adobe Bridge CS5 in windows 7 not working. I was using bridge perfectly for last 2 years. It stops working since 3 days. I tried to install updates. Showing some error to install.
Tried to install creative cloud..again some error. Error code : 82
Could you please advice how I can fix my adobe bridge.https://www.youtube.com/watch?v=xDYpTOoV81Q&feature=youtu.be
please check this video I uploaded..this is what happens when I click adobe bridge.. just blinks and go off. bridge not working on task manager -
ADOBE CLOUD ON MY DESKTOP WILL NOT WORK. IT LOADS UP BUT NOTHING FILLS THE WINDOW
ADOBE CLOUD ON MY DESKTOP WILL NOT WORK. IT LOADS UP BUT NOTHING FILLS THE WINDOW
BLANK Cloud Screen http://forums.adobe.com/message/5484303 may help
-and step by step http://forums.adobe.com/thread/1440508?tstart=0
-and http://helpx.adobe.com/creative-cloud/kb/blank-white-screen-ccp.html -
Partner application logoff not working
We have a partner application registered with sso with custom login screen. The login works fine. We use the following code to logoff the partner application in logoff.jsp
response.setHeader("Osso-Return-Url", "http://my.oracle.com" );
response.sendError(470, "Oracle SSO");
session.invalidate();
but the logoff is not working properly. It is not invalidating the session and the logout http request is not going from the application server to the sso server.
Are there any additional configurations for SSO logoff.Any help is appreciated.
ThanksHi
The WF should also trigger if i add the Partner function in UI.If i change any Attribute the WF triggers but i dont want to change the attribute when i add the partner function.
If i have only one event for WF that is Partner Change the WF will not trigger it for the 1st time when i save the UI. But next i come to the same saved doc and add a partner function then the Wf triggers.
So this means that Partner change is active.
the issue here is i need to trigger the WF on , the 1st time i save the UI, for which i wil be using Attribute Change and next time when i come back to saved doc the and add only the partner function and no changes are made to attributes the WF should again trigger.
Thanks
Tarmeem -
IPhone 4 Voice Memos not working/saving
Hi there,
I'm having trouble with my voice memos too. Up until yesterday they were working fine and now, even though the record button works, the stop button does not and I can only pause them. Worse again is that the button to go into the menu to view all voice memos is not working so I can't play them from my iPhone and nothing new is saving to my iTunes. Please help!I've always had the "Include Voice Memos" option selected. I think that only pertains to syncing voice memos from iTunes to the iPhone after it has been copied to iTunes. It has to be the new OS/iTunes not communicating that new memos have been recorded. For some reason they won't sync when I want them to, and then a few syncs later they magically appear.
By the way, I'm VERY comfortable with the iTunes and iPhone systems. I've been using iTunes for 5 years, and I've been recording class lectures with the iPhone voice memo app (and another app) for a couple years. It's not an error of not seeing that the memos were added; they don't exist in my library or music folders.
JUST OUT OF CURIOSITY, POST WHICH FIRMWARE YOU ARE RUNNING EXACTLY!!!
I'm on an iPhone 4, running firmware 4.0.1 -
Installed Premiere Pro CS4 but video display does not work?
I just got my copy of CS$. After installing Premiere I found two things that seem very wrong:
1) video display does not work, not even the little playback viewer next to improted film clips located on the project / sequence window. Audio works fine.
2) the UI is way too slow for my big beefy system.
My pc is a dual boot Vista-32 and XP system with 4GB of memory installed and nvidia geforce 280 graphics board with plenty of GPU power. The CS4 is installed on the Vista-32 partition. My windows XP partition on the same PC with Premiere CS2 works great and real fast.
Any ideas how to solve this CS4 install issue?
RonI would like to thank Dan, Hunt, and Haram:
The problem is now very clear to me. The problem only shows up with video footage imported into PP CS4 encoded with "MS Video 1" codec. So this seems to be a bug. The codec is very clearly called out and supported within various menues but video with this codec just will not play in any monitor or preview window. In addition the entire product looks horrible with respect to performance while PP CS4 trys its best to play the video. Audio will start playing after about 30 seconds. And once in awhile part of video shows up at the wrong magnification before blanking out again.
My suggestion to the Adobe team: fix the bug and add some sample footage to the next release so new installations can test their systems with known footage.
My PC is brand new with the following "beefy" components:
Motherboard
nForce 790i SLI FTW
Features:
3x PCI Express x16 graphics support
PCI Express 2.0
NVIDIA SLI-Ready (requires multiple NVIDIA GeForce GPUs)
DDR3-2000 SLI-Ready memory w/ ERP 2.0 (requires select third party system memory)
Overclocking tools
NVIDIA MediaSheild w/ 9 SATA 3 Gb/sec ports
ESA Certified
NVIDIA DualNet and FirstPacket Ethernet technology
Registered
CPU: Intel Core 2 Quad Q9550
S-Spec: SLAWQ
Ver: E36105-001
Product Code: BX80569Q9550
Made in Malaysia
Pack Date: 09/04/08
Features:
Freq.: 2.83 GHz
L2 Cache: 12 MHz Cache
FSB: 1333 MHz (MT/s)
Core: 45nm
Code named: Yorkfield
Power:95W
Socket: LGA775
Cooling: Liquid Cooled
NVIDIAGeForce GTX 280 SC graphics card
Features:
1 GB of onboard memory
Full Microsoft DirectX 10
NVIDIA 2-way and 3-way SLI Ready
NVIDIA PureVideo HD technology
NVIDIA PhysX Ready
NVIDI CUDA technology
PCI Express 2.0 support
Dual-link HDCP
OpenGL 2.1 Capaple
Output: DVI (2 dual-link), HDTV
Western Digital
2 WD VelociRaptor 300 GB SATA Hard Drives configured as Raid 0
Features:
10,000 RPM, 3 Gb/sec transfer rate
RAM Memory , Corsair 4 GB (2 x 2 GB) 1333 MHz DDR3
p/n: TW3X4G1333C9DHX G
product: CM3X2048-1333C9DHX
Features:
XMS3 DHX Dual-Path 'heat xchange'
2048 x 2 MB
1333 MHz
Latency 9-9-9-24-2T
1.6V ver3.2 -
Ideapad A1-07 tablet wifi-bluet​ooth does not work!
Hello everyone. As you can see from the title on my tablet is not working wifi and bluetooth. When turning wifi tablet is reset and continues to be off and on until it forcibly turns off, and when you turn it on again, and do not touch wifi everything is normal and there are no problems with resetting. Can someone help me and give suggestion to solve this stupid problem. I'm from Croatia and I'm bad with the English writing.
Hi
Welcome To Lenovo Community
Please perform a factory reset
Please ensure you have backed any important data before doing factory reset
Hold the volume down and the power till Lenovo logo appears .
System will boot into recover mode. Follow the instructions
Hope This Helps
Cheers!!!
Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
Did someone help you today? Press the star on the left to thank them with Kudos!
If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
Follow @LenovoForums on Twitter! -
Polygonal lasso tool not working with stylus on Surface Pro 2
Hi guys,
I'm new here so please bare with me if I'm posting in the wrong place or don't make immediate sense.
Hardeware / software used: surface pro 2 and I'm running photoshop CS5.
Problem is a fairly basic one: I am trying to make basic selections using the polygonal lasso tool (using the stylus that comes with the tablet) but it simply will not work. All I get when I touch the stylus to the screen is the circle that appears then fades. If I attach the keypad and try using that then it works no problem at all.
Does anyone have any ideas as to whether there is a particular setting that I need to switch on or off e.g. something relating to pressure sensitivity (although not sure why this would affect this particular selection tool)?
I've searched the web and come up with nothing so far so any help is greatly appreciated!
Thanks for your time
Scottsame problem on surface pro 3 !!!!
and i think quite significant, for lot of artists using polygonal lasso a lot (including me). How come that the stupid surface cannot work properly
Maybe you are looking for
-
How can I open Microsoft Word files on my iMac?
How can I open Microsoft Word files on my iMac?
-
VM does not assign all available memory to Server 1.5Gig missing
We have a number of different servers all with 5gig memory. However I can only assign 3046m to the VM I am running on Oracle VMs with Oracle Enterprise Linux 64bit on these machines. However there is a large discrepency with the Memory on the VM and
-
I have just signed up for family sharing. Is there any way you can get the same app on two devices but not have to share it? My sons both want clash of clans but they don't want to be on the same village and they can't both be on app at the same time
-
Capacity Graph Show 16gig of Others, What is that and How to clean it?
Hello iPod Touch users, Since firmware up-date v2.1 iTunes show you in the Capacity Graph of your ipodTouch and beside how much capacity in meg or gig or quantity of files it also show you a orange line name OTHERS... 1. What files are included in it
-
I'm trying to implement Machine Authentication with PEAP in ACS 5.1. The Machine should get autenticated from AD and then user authentication. We don't want to use certificate for authentication. I only selected PEAP EAP-MS-CHAPv2 protocol in Allowed