question of hitTestObject in a base class of an object library in Flash Pro.
Hello.
I have a flash file with a number of clips in the library - various bubbles that can be skipped in a clilck.
The fla has a class of documents - BubbleGame.as, and all various mcies of bubble in the library are exported for action script (using their own names, but) with a mutual Base class - BubbleBase.as, so that all the different video clips bubbles behave the same: load in a random position, play their own deadlines, pop when you click them and if not burst - reload in another post.
Here, everything works fine, however, I want the video clips removed if they hit an object on the stage. The object has an instance name of sym_mc and I tried different bits of code causes the bubble to remove when it hits this object, but I'm not getting more errors or nada.
I tried to do the code hitTestObject in document and the base class class. It seems more appropriate to have in the base class - BubbleBase.as (below), because who says the bubbles do.
In any case, I am neglecting and would appreciate it if you people took a glance at my code of the base class and the help.
Thank you: *)
package
{
import flash.display. *;
import flash.events. *;
SerializableAttribute public class BubbleBase extends MovieClip
{
var thisBubble:MovieClip;
var navdock:MovieClip;
var thisParent: *;
public void BubbleBase()
{
this.addEventListener (Event.ADDED, initialize);
this.addEventListener (MouseEvent.CLICK, pop);
}
function initialize(event:Event):void
{
thisParent = event.currentTarget.parent;
navdock = thisParent.sym_mc;
thisBubble = MovieClip (this.parent.getChildByName (this.name));
if(currentFrame == 1)
{
This.x = Math.Random () * stage.stageWidth;
This.y = Math.Random () * stage.stageHeight;
Turning = Math.Random () *-90;
}
this.addEventListener (Event.ENTER_FRAME, moveBubble);
}
function moveBubble(event:Event):void
{
this / * if (this.hitTestObject (navdock)) is commented out, because it generates an error – TypeError: Error #2007: hitTestObject parameter must be null.
{
trace ("hit!");
this.removeEventListener (Event.ENTER_FRAME, moveBubble);
thisBubble.removeEventListener (Event.ENTER_FRAME, onEnterFrame);
this.removeEventListener (MouseEvent.CLICK, pop);
this.parent.removeChild (thisBubble);
}
on the other
{
This.x = Math.Random () * stage.stageWidth;
This.y = Math.Random () * stage.stageWidth;
}*/
}
function pop(event:MouseEvent):void
{
this.removeEventListener (Event.ADDED, initialize);
var host: MovieClip = MovieClip (this.parent.parent);
main.increaseScore ();
this.parent.removeChild (thisBubble);
}
}
}
Hi ned. _spoyboyle
Guess what?, I have corrected the code - see below, noting the change added
to ADDED_TO_STAGE in the constructor, with removeEventListeners as a result
in the rest.
And to fix the error null, I added to remove the pop function; I could not
figure that a person on until after I was able to get sym_mc to be identifiable
-by the change in the type (ADDED_TO_STAGE).
I managed the setting, BTW, thanks to you, Ned, in terms of making the simplified
version coming out specific errors, which iwas able to isolate, to
Look up in the search field Flash as such - "TypeError: Error #1009: cannot.
access a property or method of an object reference null + at
Flash.Display::Sprite/constructChildren().
Which lead me to various options, among which was that -
http://kb2.adobe.com/cps/838/cpsid_83815.html - that was the solution.
But also through _spoboyle, providing the correct 'if' statemnt with
no = null.
Thank you so much, people
And now, I feel silly to tell you all that after getting this work.
my bubble game is less good looking than before that the hitTestObject was
added, because after a few runs (bubbles in jumps, removed, and)
regenerated) some of the bubbles are removed without for as much hit
the item on stage - but little to chance, plus button that generates
more bubbles (bubbleMaker.start ()); is not as responsive as it is without
the ifHitTestObj and finally, my processor - healthy and strong although it
is, is tested with all these bubbles and their maturities, but
all this is another question for later review.
For now, thanks again :)
package
{
import flash.display. *;
import flash.events. *;
SerializableAttribute public class BubbleBaseNew extends MovieClip
{
var thisBubble:MovieClip;
var navdock:MovieClip;
var thisParent: *;
public void BubbleBaseNew()
{
this.addEventListener (Event.ADDED_TO_STAGE, initialize); off
http://kb2.Adobe.com/CPS/838/cpsid_83815.html do ADDED_TO_STAGE instead
added
this.addEventListener (MouseEvent.CLICK, pop);
}
function initialize(event:Event):void
{
this.removeEventListener (Event.ADDED_TO_STAGE,
Initialize); This causes sym_mc be defined as an object
thisParent = event.currentTarget.parent;
navdock = thisParent.nav_mc;
thisBubble = MovieClip (this.parent.getChildByName (this.name));
this.addEventListener (Event.ENTER_FRAME, moveBubble);
}
function moveBubble(event:Event):void
{
If (navdock! = null & this.hitTestObject (navdock))
{
trace ("hit!");
this.removeEventListener (Event.ENTER_FRAME, moveBubble);
thisBubble.removeEventListener (Event.ENTER_FRAME,
onEnterFrame);
this.removeEventListener (MouseEvent.CLICK, pop);
this.parent.removeChild (thisBubble);
}
on the other
{//this times normal (the chronology of the bubble), but the trace says
sym_mc: undefined
var mc:MovieClip = event.target as MovieClip;
if(currentFrame == 1)
{
MC.x = Math.Random () * stage.stageWidth;
MC.y = Math.Random () * stage.stageHeight;
Turning = Math.Random () *-90;
}
}
}
function pop(event:MouseEvent):void
{
this.removeEventListener (Event.ADDED_TO_STAGE, initialize);
this.removeEventListener (MouseEvent.CLICK, pop);
this.removeEventListener (Event.ENTER_FRAME, moveBubble);
var host: MovieClip = MovieClip (this.parent.parent);
main.increaseScore ();
this.parent.removeChild (thisBubble);
}
}
Tags: Adobe Animate
Similar Questions
-
Substitution of the class, how to create the child class and then the base class
I started to write a program for a DMM smart, that the problem is all versions of DMM greet the change company communication.
My idea is to write a child class for each version, DMM and each Subvi child will replace the Subvi base class.
My problem is, I first want to create a child class and after I see everything is working, start creating the base class. in this way, I'll see if think the right way.
My question is
How can I create a child class and then create the base class and configure the Subvi class of the child to be the substitution of the base class?
I tried searching in the property of the class, but I don't see anything.
Thank you
This can be done and I did on occasion.
You create the base class with the methods of dynamic distribution, you need (Connector components must be identical to those of the class of the child).
Set then the legacy of the class inherits this base class. If your method is defined as a dynamic distribution method in the parent, you will probably now have some errors (unless your method of child was already DD, in which case you might be OK already).
To change the inheritance of a class, right-click on the properties of the class in your project, and then select Properties. According to me, the tree of estate is at the lower end of the property. Click on the 'legacy of change' (or something similar) to choose the class from which you now want to inherit.
-
How to remove base class event listeners
Guys, I have a base class (he is a clip) in which I added event listeners:
addEventListener (MouseEvent.MOUSE_OVER, mouseOverHandler);
OK, it works and everything is beautiful.
But I have a subclass that clip in class 'regular ': as3
class DifferentClass extends MyMovieClip
{
}
you get the gist.
Now, I want in my DifferentClass also have the MOUSE_OVER event, but without never to raise the base class event.
No one knows how to do?
Thank you.
override protected function mouseOverHandler(e:MouseEvent):void {}
do not call super. Instead, do your own thing custom
}
No need to call getQualifiedClassName. This is what has protected methods are for!
Note You can also listen to a higher priority and the preventImmediatePropogation() on the event if for any reason any substitution does not work for you.
-
import a class: how many ways are there? CFC, import, extend the base class
How many ways is there to import a class and am I confused
1 screen/public class extends MovieClip
This inherits all the properties and methods of the MovieClip class so WHY again do we use: import flash.display.MovieClip;
Import something else or just made the job twice
2 import flash.display.MovieClip - so no need to extend (repeat me once again - see 1)
3 CFCS: connect to a CFC
4. stir in a SWF with a meta tag
5. in the properties panel menu - add a class as a base class
OMG - a bit confusing
You can only "extend" another class if the compiler knows where he is.
The import statement is only by the compiler to find the class on your hard drive.
It is not "import" of the entire class in the sense that you import a BMP in Photoshop.
-
How to find the symbol of a certain library Base class
Hi, all.
I need to find all the symbols (if any) in my library that have a certain class as the Base class field. Y at - it an easy way to do within Flash itself, or is there an extension that focuses on this area, while doing a search of the symbols of the library?
Thank you;
Amy
You can use jsfl to see that.
you would use the assets Library property class' (a table) for loop through each element of the library and use the linkageClassName property to check the desired base classes.
-
How to change a Base class methods
Hello
I extend a CO and the base co uses a method processReturnButton() in which he uses the executeServerCommand and then proceed to a treatment and passes the URL to another page.
I want the same functionality to happen except the redirect URL to a different page. How can I achieve this.
Thank you
HCCCG
will the base class call points to the base class method instead of the overriden method I guess.
If you call processReturnButton method of parent CO then always the Parent processReturnButton will not be called the overloaded method.
I hope I am clear.
Kind regards
GYAN -
class and base class in the properties panel
I have a sunny called mc. In the properties panel, I him export for actionscript. I put Sunny in the main class and drag in the base class. The reason is I want it be draggable. I can't use drag in the main class as another object uses this name. The Drag.as has the sliding feature.
Why can't I hang out sound. I already have a solution - I wrote a specific class for it and extended the Drag class. However, if I have 10 mcs I won't write specific classes for each of them.
To sum up: using the base class drag in the properties panel - why is she not movable?
See you soon
In addition,
"I wrote a specific class for it and extended the Drag class. However, if I have 10 mcs I won't write specific classes for each of them. »
You don't have to write classes for them, but you need unique class for each of them as a binding class field name. If you do not write classes - Flash will do it for you in the compilation.
-
Hello
I'm experience the following problem, I can't locate or find the base class for events when I do "import flash.events;"-AutoComplete does not work as well. import flash. available only - flash.errors and flash.text
However if I spend the Flex SDK 4.1 to 3.2 the Flex SDK kit so no problem and I can add flash.events
SDK Flex 4.1 version is 4.1.0. 65265, I also tried Flex 4.0 SDK, the same problem, not able to find events.
Requires the flash player version I tried both: 10.0.0 and 10.1.0 does not.
Could you please suggest what might be wrong. Unfortunately not be able to find this info in the forum or google
Thank you
Kind regards
Marakame
Have you tried
import flash.events. *;
Or
import flash.events.Event;
-
Base class for understand - trying to understand AS3
I'm relatively new to AS3 and AS in general, so forgive me...
Is I understand that there is no abstract classes and you can override or overload the constructors of classes derived correct? Abstract classes are not important to me, but if possible I would like to know how. But is it possible to overload the default constructors and I do just something wrong? Can override us only the methods or we can overload them too. Workarounds would also be appreciated.
Here's what I do now to make things work.
-For a simple game that I do, I do not use FlexBuilder and don't want for this project for specific reasons, so I use Flash and instead to use bitmaps and sprites, I want to draw shapes in Flash and hidden in the MovieClip symbols that I 'link' for export as for use in my code. I want to make a little modular so can I just change some aspects of the code for different approaches.
If I create an actor class that extends MovieClip the default constructor must be Actor() without argument. But I want my class to be able to have arguments as coordinated initial x and y. I know that you can just create methods to initialize every part, but I would try to have a default constructor to do.
In Flash, I notice that if you derive a class written or built in class requires the standard constructor by default, "I may be wrong on someone could show me what I'm doing wrong and I hope I'm ', if you derive a class based on a symbol you export related LIKE I can create a new constructor , with whatever the arguments, I want (so that's why I'm doing this post, I found if I can do it couldn't there be a way to substitute manufacturers?).
Here is how I currently do...
(1) so that I create a base called actor class that extends MovieClip the record as a Builder by default and Actor.as of Actor() add some properties I want.
(2) then I create an object in my library, let's call it mcShip, then I link this symbol to export ActionScript and have its base as an actor class and name the class ShipMC.
(3) I then create a new .as file and call this a ShipActor.as, this ShipActor class extends ShipMC and then I create a default constructor ShipActor (gs:GameScreen, xA:Number, are: number) and it works fine
(I also create a method in the class actor called ActorSuper and call from ShipActor with any arguments passed in, because I do not know how to overload the constructor of the parent class)
If I just had my mcShip with a base class of flash.display.MovieClip and I'm trying to create a ShipActor with the constructor above it says missing default constructor. The 3 steps above is the only way I can get it to work for now. Is it possible to overload the constructor? If this isn't the case, are there some other workarounds?
I seek only to this object oriented approach more than anything. Sorry for the long post but I didn't want any confusion or confusion more-. -.
Thank you for taking the time to read this post
-JohnYour rationale that you cannot define class abstract in ECMA based actionscript or Actionscript allows overloading at all. There are two solutions to workaround if such have also just your overloaded methods use a single object as its argument and this object contains the various parameters.
I find developing in the difficult at best Flash IDE if you want another option besides flex builder, you can use eclipse with FDT kit webtool. What doesn't is that got 30 days free, but its value to buy (believe me). A tip is to install the latest version of the flex sdk and to change the library source in it so you can use Ant to build your SWFs.
I was just about to an object called actor extends Sprite instead of MovieClip package unless you're going to manipulate its chronology (why would you however). If you need a check-out package TweenLite of GreenSock interpolation. Its better than the default flash.
-
definition of the base class _ not found
Hello!
While exploring Flex 3 (really good btw) and build my first app, I tried the following:
SerializableAttribute public class X extends EventDispatcher {}
It gives me a compilation error #1017: the definition of the EventDispatcher base class was not found.
To compile I am just use a file .bat, such as those used in the samples. Everything compiles normally without extending an existing class (in this case flash.events.EventDispatcher).
Try to change the compiler options with
-library-path += c:\flex\framework\libs
has resulted in the same error here (and I guess that's already a default setting).
Any help would be greatly appreciated!
Fre
It worked :-). Thank you very much, Deepa!
So, apparently, you can make import declarations in the declaration of class (or anywhere in the code), but always before you use the imported class. I got confused, as in java, all import instructions are in the same place and import flash.net worked under my class declaration.
-
Method in class java.lang.Object [] business need not be declared as final
Hello
I'm deploying a Java 7. EAR to Weblogic 12.1.3 and I get the following error
The track repeats four times, changing the method name that is highlighted in bold: wait, getClass, notify, and notifyAll
Can someone explain to me what was going on? The stack trace shows nothing else. There seems to be something to do with EJB.
This post is the only related information I ve got EJB 3.0 and jndi lookup (simple question) , but it suggests to use @Remote worthless. That s not my case. This app has worked before with @Remote pointing to a Remote Interface
Any help much appreciated
Thank you
weblogic.ejb.container.compliance.ComplianceException: method of business [wait / getClass / notify / notifyAll] in class java.lang.Object must not be declared as final
at weblogic.ejb.container.compliance.Ejb30SessionBeanClassChecker.validateBusinessMethod(Ejb30SessionBeanClassChecker.java:274)
at weblogic.ejb.container.compliance.Ejb30SessionBeanClassChecker.checkBusinessMethods(Ejb30SessionBeanClassChecker.java:229)
at sun.reflect.GeneratedMethodAccessor232.invoke (unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at weblogic.ejb.container.compliance.EJBComplianceChecker.check(EJBComplianceChecker.java:100)
at weblogic.ejb.container.compliance.EJBComplianceChecker.check(EJBComplianceChecker.java:90)
at weblogic.ejb.container.compliance.EJBComplianceChecker.checkDeploymentInfo(EJBComplianceChecker.java:81)
at weblogic.ejb.container.ejbc.EJBCompiler.doCompile(EJBCompiler.java:172)
at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:346)
at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:314)
at weblogic.ejb.container.deployer.EJBDeployer.compileJar(EJBDeployer.java:429)
at weblogic.ejb.container.deployer.EJBDeployer.compileIfNecessary(EJBDeployer.java:355)
at weblogic.ejb.container.deployer.EJBDeployer.prepare(EJBDeployer.java:723)
at weblogic.ejb.container.deployer.EjbModuleExtension.postPrepare(EjbModuleExtension.java:98)
to weblogic.application.internal.ExtensibleModuleWrapper$ PrepareStateChange.next (ExtensibleModuleWrapper.java:297)
to weblogic.application.internal.ExtensibleModuleWrapper$ PrepareStateChange.next (ExtensibleModuleWrapper.java:285)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:109)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
to weblogic.application.internal.flow.ModuleStateDriver$ 1.next(ModuleStateDriver.java:175)
to weblogic.application.internal.flow.ModuleStateDriver$ 1.next(ModuleStateDriver.java:170)
to weblogic.application.utils.StateMachineDriver$ ParallelChange.run (StateMachineDriver.java:80)
at weblogic.work.ContextWrap.run(ContextWrap.java:40)
to weblogic.work.SelfTuningWorkManagerImpl$ WorkAdapterImpl.run (SelfTuningWorkManagerImpl.java:548)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
I thought about it
In one of my EBJ´s @Local and @Remote have been pointing to the same Interface
In any case, the error does not specify which EJB is a failure. He says nothing, really
-
Math.Random in a document with Flash Pro class
Hello.
in a previous discussion, I had help with randomization of the position of the "appeaance" on an mc on the stage (http://forums.adobe.com/thread/946317?tstart=0), with code is in the file Flash Pro.
Here, I ask help randomizing positioning using Math.random but by using a class of documents, in order to avoid rewriting the code for the film of many clips I have in the library.
Clips in the library begin and end with about 15 blank keyframes: they have 2 layers, one for action script and the other for the graphics (which are also filmed sequences,) while the level of the AS in the video clip is longer than the layer containing art, on both ends, beginning and end, so the effect is of bubbles popping up and appearing on the stage in random positions.
In the library movie clip symbols have a base popBubble.as class, who works at removeChild (this).
However, using RandomPosBubble.as in the class of document of the flash file, I get a script error-
D:... RandomPosBubble.as, line 17 1084: syntax error: expected rightparen before the colon. See RandomPosBubble.as below
package
{
import flash.display.MovieClip;
import flash.events. *;
SerializableAttribute public class RandomPosBubble extends MovieClip
{
public void RandomPosBubble()
{
this.addEventListener (Event.ENTER_FRAME, onEnterFrame);
_spoboyle said - this will set up a listener for the enterFrame event.
Each image we check if the MovieClip is on frame 1 and if so recalculate its position
}
private void onEnterFrame(e:Event):void
{
var mc:MovieClip = e.target as MovieClip;
If (mc:currentFrame == 1)
{
MC.x = Math.random () * stage.stageWidth;
MC.y = Math.random () * stage.stageHeight;
}
}
}
}
Thank you.
the example that I have running does not produce the same model whenever they appear
Use this as a replacement for the previous Bubble.as file will make them appear at different times
package { import flash.events.Event; public class Bubble extends BubbleMC { public function Bubble() { addEventListener(Event.ADDED_TO_STAGE, onAdded); } private function onAdded(e:Event):void { x = Math.random() * stage.stageWidth; y = Math.random() * stage.stageHeight; var startFrame:int = Math.random() * 85; trace(startFrame); gotoAndPlay(startFrame); addEventListener(Event.ENTER_FRAME, onEnterFrameHandler); } private function onEnterFrameHandler(e:Event):void { if (currentFrame == 1) { x = Math.random() * stage.stageWidth; y = Math.random() * stage.stageHeight; } } } }
-
Attaching a class to several symbols library
Hello again,
I am so grateful for the help I've gotten so far!
Here's the situation: I have written a class called ButtonGlow in ButtonGlow.as. I made a movieclip with the "Base class: ' of 'flash.display.MovieClip' and the ' class: ' to 'ButtonGlow '. It actually works!
Then, I created a 2nd button on the stage. I clicked on one to enter the link information, but he wouldn't let me enter 'ButtonGlow' error is:
Please enter a unique class name that is not associated with other symbols from the library
I thought that was the purpose of making a class !
I can't imagine doing all my buttons have, because they are graphic and I to see them together. Do it all in like make blind.
I would appreciate any idea of those Wise.Seems that you try to add an event to the class listener - and not
the instance.var myIntBtn: intBtn = new intBtn();
myIntBtn.addEventListener (MouseEvent.CLICK, intClick);function intClick(event:MouseEvent):void {}
navigateToURL (new URLRequest ("galleryInt.htm"));
} -
can I use Transcend 64 GB SDXC UHS Ultra TS64GSDU3 high speed class 3 memory card in my macbook pro
Should be good:
-
Data members of the object to contain LabVIEW - classes will not object accessors in CSC
I found this weird bug with LabVIEW 2013. I create a class that has objects as data members and I'm not able to enter in the CSC. I can do it manually via the GUI of Perforce, but it's kind of a pain. Here are some photos to show what I mean
Here's a generic VI I can add
Here's the accessors that I can't add
Accessors that are standard labview data types (strings, tables, figures, etc.) are fine, but it does not play well with objects. Has anyone else encountered this?
Could this be a problem of name?
Can see that you name as the vi name.lvclass.vi
Have you tried to remove the name of the vi .lvclass?
Maybe you are looking for
-
Where to find drivers Windows 7 for Satellite L500-14F?
Hi there, everyone. Can someone please help me find the drivers for my * Setellite of Toshiba L500-14F * for * Windows 7 *. Or All it may be Possible to downgrade this laptop to * Windows XP Pro *? and where I can find drivers for this? I will be tha
-
Problems with the tabs in safari
Please can someone help me. When I open a new tab in safari, it won't let me enter anything, he'll let me only to open a site in my favorites. He also does this weird thing where I find myself with two tabs in a tab - please see screenshot.
-
can I remove the progam that I do not?
Can I remove the program that came with my desktop computer? (HpPSC & officejet 3.0) I do not use. Compaq sr1911x w/windows xp
-
Can not get my portable floppy drive to work on my computer
Original title: I have a portable floppy drive that works on all computers but mine! It indicates that the device is installed and ready to use, but when I put in a disc, nothing happens. What can I do? It was in the shop and they said it worked fine
-
My touchpad doesn't work. The device is more listed in Device Manager. I rebooted that made no difference. I don't see anything obvious in the event logs (System Windows or Application), but I am not sure what newspapers should be checked. Anyone