OnPress and onDragover
I have 100 movieclips on stage (in square shape). When I onPress one of them it should highlight. Till I release the mouse button and drag mouse over all movieclips they all should also highlight irrespective of on which movieclips I pressed the mouse.
If I again pressed on any of the movieclips highlighted and drag the mouse over other movieclips they should go back to their original position.
Could you help me in achieving this? Thank you.
in your onPress start a loop the checks for a hittest with your movieclips. if positive, highlight them if they are not already highlighted and un-highlight them if they are already highlighted. onRelease terminate the loop.
Similar Messages
-
Hello guys. I am new to Flash and would like some help from you guys. I would really appreciate it. Thanks,
So, here is the problem.
My friend has created a flash navigation bar for me. Since I can not add links here, huhtea is the address with com.
Now, I would like to add text links and onPress (getURL) for images in my submenu.
I have tried all kinds of things. I have watched numerous youtube clips on this matter.
After adding onPress codes in Actionscript 1.0 & 2.0 and checking them, everything was fine. But if I publish it, the image does not go to the URL.
This goes for the text link as well. After highlighting the text and adding http address in the properties, everything is fine. But again, published file does not lead me to the URL.
Can someone please help me out?
Thanks,If I look at the page code of the page you say to look at, I'd say your problem lies there, and possibly in the flash file as well. I see one url in that page that targets a local drive, which is not going to work...
url=Link[file\:/C\:/Program%20Files%20(x86)/Yahoo%20SiteBuilder/sites/Imex/ready.html
So it is possible you have other such links in your Flash file. I am not able to find the swf's in that page code, and seeing as how it indicates something in the way of Yahoo Site Builder being used, there could be any number of problems in trying to go that route.
What does the getURL code look like in your Flash file? If you are using relative links, that might be related to the problem, especially if the Flash file is in a different folder than the web page. -
Hello Everyone,
I would highly appreciate your wisdom and advice on this
functionality. Lets say I have two
movieclips on the stage(ClipA, ClipB). I would like user to
be able to click on any of them and, this click
will invode a createclip function which pretty much creates a
dynamic movieclip and loads
whatever I assign to it such other existing clips within the
library. The only problem I have
makeing the functionality work is that I would like to limit
the function call to one at a time.
So if the user clicks on ClipA, function createclip would get
invoke and will attach the assigned
movie clip. And when user clicks on ClipB, I would like to
end the function call that was invoked
by the ClipA and then then allow ClipB to invoke the
function.
Pretty much it would a logic like:
if(createClip = true)
end it;
else
createClip();
When a movie is attached, can it be unloaded or unattached?
I don't know how to write a function that would check if
function createClip() has
already been invoked. I would highly appreciate any direction
in this.If the objective is just to get a unique list of authors based on your key, you could use the REPLACE statement in MySQL which functions as an "insert on duplicate key update" type of construct.
[http://dev.mysql.com/doc/refman/5.0/en/replace.html|http://dev.mysql.com/doc/refman/5.0/en/replace.html]
Catching an exception to detect dupes is functional but not very elegant. If you use REPLACE then you know your statements will always work. The drawback is that the statement is not portable across databases. -
OnPress=null; problems
Hi all,
I have a clip on the main timeline (parentClip) that has an
onPress event set, and it contains a child movie clip, also with an
onPress event.
When I click parentClip, it traces 'parent' and then clears
the onPress event. When I then click the child clip, nothing
happens (it should trace 'child').
I have tried to clear the parent onPress in two ways:
(a) set onPress to null or undefined. This does clear the
onPress, but leaves the mouse pointer as a hand, and child onPress
doesn't work.
(b) Set parent 'enabled' to false. This clears onPress, but
child onPress still doesn't work.
How can I clear the parent onPress and still keep the child
one working?
Regards,
PeterUse delete.
// _root.parentClip
parentClip.onRelease=function(){
trace('parent');
//this.onPress=null;
// this.onPress=undefined;
delete parentClip.onRelease;
// _root.parentClip.childClip
parentClip.childClip.onPress=function(){
trace('child');
} -
I am a designer working on a flash project that is used to navigate to html pages. The project is a map - when you roll over different states there is an animation making that state pop out and show the state name. When you click each state (Button), it should open an html webpage. Right now the project works great, but I have the url's coded in flash actionscript using "onpress" and "load url." I would like to set it up so the flash file calls the URL for each button from an xml file, so it can be easily edited. The only thing it needs to call is the URL for each button. Can anyone give me simple instructions on how to make that happen?
you'll need to change all the code attached to those buttons so each button has an instance name and you use that name to code for your mouse handler.
and, if you're going to make those changes, you may as well use movieclip buttons and set this up so the next step is easier to accomplish. -
AS2-CS4 unnullify "Null"?
I'm creating a card game tutorial (well, a small part of what will be a tutorial) and ran into a wall.
A movieclip has an onRollOver, onRollOut, onPress and onRelease state, each doing different things (go figure). In the onRelease state, I nullified all 3 other states so that the movieclip becomes frozen, i.e. movieclip.onRollOver=null; etc.
How do I disarm the null when a reset button (resetBtn) is pressed?
Attached is an example of my problem.Generally I wouldn't null all the event handlers, instead I would just disable the clip.
myClip.enabled=false;
That will prevent the events from being dispatched.
Then it is easy to have a function that goes through all your clips (you'll have to keep track of them some how) and set the enabled property to true.
Or you could do the same type of thing with reassigning the event handlers.
I'm guessing that you've originally set them up something like this:
myClip.onRollOver=function(){
//some code
That isn't the best practice. You should do it like this:
myClip.onRollOver=handleOverClip;
function handleOverClip(){
//some code
Then you can easily reapply it by just reassigning the function. -
Hello,
I am building a Smile Face application.
Where you choose a menu item and an object or "movieclip" is
placed on the stage. You can drag and drop the object, take it to
the trash and change the color on any of the objects on the stage
at any time.
I have 2 problems that I am looking for guidance on.
1. The code I use to change the color of the object is bulky.
As it is, depending upon the amount of objects you have in
the menu,
the code could grow to a painful amount making it difficult
to manage.
I am looking for a way to better my existing code, by
upgrading it to a more advanced method.
I have attached my code here.
If anyone could help steer me in the right direction, I would
appreciate it.
Thanks,
MatthewThanks for the answer Rob.
It works perfect.
I apologize for my last tread not making much sense.
I have one question, that I would like to find the answer to.
Is there anyway to create this function.
for (j in partsList) {
partsList[j].onPress = choosePart;
Without it being an onPress, onRelease, onRollOver or
onRollOut function?
I ask, because I am incorporating
the "GreenSock transform manager"
which is already using the onPress and onRelease function for
the partsList.
http://blog.greensock.com/transformmanageras2/)
Hope that makes sense,
Thanks. -
Problem targeting a loaded MC (easy answer?)
Hi, thanks in advance. I'm lame and can't figure out how to
target an external swf that I've loaded via AS. I have one main
swf, and in that swf I'm creating an empty movie clip (called
'countryClip') and loading an external swf ('usa.swf'). So far, so
good, the swf loads and it looks great. But when I try to click on
the loaded swf, I get nothing. My usa.swf ('countryClip.usa'?) is
just unclickable, and that's my problem. Any ideas why? What am I
overlooking?
[begin code]
_root.createEmptyMovieClip("countryClip", 1);
countryClip.loadMovie("usa.swf");
// everything above works great. but then...
_root.countryClip.onPress = function() {
// has no effect at all.
// so I put this into frame 1 of usa.swf
onClipEvent (enterFrame) {
trace(this._target);
// and that showed me this output:
"/countryClip/usa" (no quotes)
// which led me to believe that the following
// should work...
_root.countryClip.usa.onPress = function() {
trace("pressed");
// but it does not work. Why?
[/end code]Hi,
the loaded swf is accessible via the instance name of the MC
that loaded it, so _root.countryClip.onPress should work. Now when
you look at the Flash Help for loadMovie(), you'll find this:
quote:
Using event handlers with MovieClip.loadMovie() can be
unpredictable. If you attach an event handler to a button by using
on(), or if you create a dynamic handler by using an event handler
method such as MovieClip.onPress(), and then you call loadMovie(),
the event handler does not remain after the new content is loaded.
So this should be the reason it's not working. One solution
would be checking the loading progress, and assign the event when
the clip is fully loaded. You can use something like the attached
code, or use the MovieClipLoader class to load the swf and use it's
events (e.g. onLoadInit) to assign the onPress event.
greets,
blemmo -
V2 Flash components unsupported in Director?
Page 11 of
http://www.adobe.com/support/director/flash_8_asset_xtra.pdf
states that v2 Flash components are unsupported by the Flash Asset
Xtra.
What exactly does this mean, particularly when all the
built-in Flash components are v2 components, aren't they?I have a scrollpane in a SWF that gets pulled into director
which doesn't
have that problem.
However I have had plenty of problems with other Flash things
in Director
requrinand I found changing onMouseUp to onRelease or
onMouseDown to onPress
and it usually solves the problem. I don't know if you have
access to the
code for the scroll pane without overriding the class in
Flash.
Timm
"davdavdavdav" <[email protected]> wrote in
message
news:fr81er$6q5$[email protected]..
> Hi, I am new to Director MX 2004 and I have successfully
added a
> Scrollpane
> (Flash component).
>
> The problem is that when I make a projector file and run
it, before I can
> scroll on the Scrollpane, I need to click on it once to
activate it. This
> is
> annoying like many web sites using flash.
>
> Any solutions to this??
> -
I am making a video player with flash mx 2004,
When the control bar/volume slider isn't be used, it goes
transparent,
but, when it does, or if it has the ability to, and function
that have a startDrag function in it, don't work,
all the other buttons work(they are movie clips), but the
scrubber(the little part on the video timeline, that you can hold
and drag to seek through the movie), and the volume slider don't
move when clicked on,
I put a trace in the function that calls them "scrub.onPress"
and "volumescrub.onPress" it doesn't show,
which would obviously mean that the function doesn't even get
called,
I will attach the code,
I would really appreciate help,
Thank You to EVERYONE that even helps a bitI wasn't trying to put it in the center, but anytime I tried to get it to snap inside the dynamic text field it kept jumping to an outside edge of the box instead of inside. No matter what I did it acted like it just wasn't going to stay inside. After reading your reply I went back and made sure "snap to object" was selected, thinking last time I was selecting snap to guides or grid. Much to my dissapointment snap to object was selcted, but I tried it one more time and damn if it didn't suddenly work like it was supposed to. Not sure what happened, but I believe that was it.
Thanks -
Hi all,
I'm new to Flash and I'm new to OOP, and so I'm having a bit
of trouble writing ActionScript programs to do exactly what I want.
I am trying to create a simple application, in which a
MovieClip is dragged around the screen and a textbox gets updated
with the MovieClip's coordinates somewhere else on the screen. I
wanted to do this using custom classes, so I created a class called
MovieClipCoordinates that would contain a MovieClip and a
TextField. I am initializing the MovieClip as the output of a
this.createEmptyMovieClip() of the main movie, and the TextField
similarly.
My intention is to have the TextField updated whenever the
MovieClip is dragged. So, in the onRelease function of the
MovieClip, I need to update the TextField of the
MovieClipCoordinates object that the MovieClip is a property of.
The problem is, I have no idea how to find out the
MovieClipCoordinates that the MovieClip belongs to. I thought I
would create a method in the MovieClipCoordinates class that would
set the TextField, which would be called from the
MovieClip.onRelease. So I figured I would not have a MovieClip
inside the MovieClipCoordinates class, but instead another class
inherited from MovieClip which also contains a reference to the
MovieClipCoordinates class that it is a member of. However, the
problem now is that I can no longer create this subclass through a
call to createEmptyMovieClip. So how do I create it?
I'm getting a bit confused at this point of time. Could
someone please give me some idea of how to do this?
Thanks.
AjitLuigiL,
Thank you very much for your assistance. I truly appreciate
it.
Though the code works perfectly, I wonder if I may trouble
you to clarify a couple of questions that I have with your code.
Looking particularly at this section of the code:
private function setHandlers(target_mc:MovieClip):Void{
//use a reference to the current object
var thisObj:MovieClipCoordinates=this;
target_mc.onPress=function():Void{
this.startDrag();
target_mc.onRelease=function():Void{
this.stopDrag();
//get the new coordinates
var thisX=thisObj.box_mc._x;
var thisY=thisObj.box_mc._y;
//and refresh the text
thisObj.printCoordinates(thisX,thisY);
How is it legal to use thisObj inside the onRelease function?
I was under the impression that the onRelease function is a
separate function altogether, that is called in the context of the
MovieClip that it is associated with. How does it have knowledge of
thisObj, which was defined in scope above it?
Would it be even possible to define the onPress and onRelease
functions above as two separate functions (CoordinatesPress and
CoordinatesRelease, for example) and rewrite the above code as
follows?:
private function setHandlers(target_mc:MovieClip):Void{
//use a reference to the current object
var thisObj:MovieClipCoordinates=this;
target_mc.onPress=CoordinatesPress;
target_mc.onRelease=CoordinatesRelease;
defining the handler functions separately. If I chose to do
this, how would I possibly pass the thisObj to the handlers?
I seem to be missing something fundamental in ActionScript
functions, or perhaps just in the event-handlers. I would
appreciate it if you could help me clear this up.
Thanks again,
Ajit -
Use Any key to activate a button
HI,
I was wondering if there is anyway to activate a button by
hitting any key?
Currently I have this code but it doesnt seem to work,
var keyListener:Object = new Object();
Key.addListener(keyListener);
keyListener.onKeyDown = function() {
processInput();
my_btn.onPress = processInput;
function processInput() {
gotoAndStop("Scene 2", 1);
Any help will be muchly appreciatedEDIT : IGNORE THIS POST
Ahh... so scene 2 is inside your button.... that explains it.
Its working... but what is happening is that inside your
processInput function your gotoAndStop is looking in different
timelines. You can see the difference in the traces between when
the keyListener calls it and when your button onPress handler calls
it.
I had assumed you wanted to move the button's parent timeline
on... but it was the button's timeline that you wanted to change.
(I just re-read your earlier post - you did say that but I missed
it, sorry)
try changing this:
keyListener.onKeyDown = function() {
processInput();
to this:
keyListener.onKeyDown = function() {
my_btn.onPress();
and you can get rid of the timeline variable.
inside processInput:
make it :
this.gotoAndStop("Scene 2", 1) -
Embedded swf in director on touch screen - double tap required
There is a known problem with swf's with nested mc's embedded in a director projector when used on a touchscreen (with dragmode enabled)
I've found many threads referring to the problem (here's some), but none of the solutions suit my particular situation.
http://www.directorforum.de/threads/54055-Flash-within-touchscreen
http://www.directorforum.de/threads/52818-Mouse-events-for-Flash-Object-in-Director-on-tou chscreen
http://forums.adobe.com/thread/159381?tstart=0
Basically, the problem is that flash requires a mouseRollOver event to give the focus to the mc, before it registers an onPress. With a touchscreen, where the cursor is disabled, the first click and release on the swf (or nested mc's) reads as an onRollOver event, and the user must click again to register an onPress and onRelease. This leads to very confusing behaviours in my application where I have dots (embedded mc's) being created when an image is touched, then the dots can be clicked and dragged, or double tapped to be removed.
All works fine when the mouse and cursor is used, but I can't get it to work using a single tap on the touchscreen. In some cases I can get away with using onRollOver but when used with startDrag I can't think of a way of stopping the drag when the user lifts their finger. (which doesn't register as an event)
What I need is an AS2 script that forces a click event (onPress) when the user taps the button once. Unfortunately I only know AS2 so can't use mouseEvents from AS3. I've spent days on this (after I thought I'd got all the bugs out) and have run out of ideas. Any suggestions appreciated pleaseManaged to get around it along the lines of: this[my_name].onRollOver = function()
pressAction(my_name);
}; this[my_name].onPress = function()
pressAction(my_name);
}; where pressAction() starts the drag and sets dotName and a flag to record if its using the rollover or press.
then on the base movieclip... this.onMouseUp = function()
this[dotName].stopDrag();
}; -
Hi All
So I am building a simple flex site wich loads a flash swf
file into it. In the real site that file is a photo gallery that I
have. for debugging I have created a simple flash file. I have ran
accross a few wierd bugs.
the movie is very simple two buttons. A movie loads in at
start using loadMovie(). Then I have two buttons that load
additional Movies when pressed. the code is really simple
this.createEmptyMovieClip("mcLoader",100);
mcLoader.loadMovie("move.swf")
mybtn.onPress = function() {
mcLoader.loadMovie("move2.swf")
mybtn2.onPress = function() {
mcLoader.loadMovie("move.swf")
this works great on its own
http://www.rubberduckymedia.com/projects/mi/load.swf
now the problems come when I load this in flex
one issue is that the button press does not always get called
I press any of the buttons once it kills the loaded movie I press
it again it reloads it WIERD
even wierder is that on a mac the buttons dont work at all. I
thought that flash was supposed to be platform browser indepandent.
I am stuck and frustrated as this app works great in any
browser windows except for the buttons not alwasy working but I
just did a onPress and onRelease to execute the same button code
and that solves that issue. Not the best solution but it works. I
am just frustrated with the mac issue
Dave
OneIt might be a player version issue. Can you verify that the
PC and Mac Flash Players are the same revision? You can also grab
the one on Adobe labs (
http://labs.adobe.com/technologies/flashplayer9/)
and try it with that. This way we can eliminate any player version
issues. We might have a bug in the Mac player and it would be good
to resolve it quickly.
How are you loading the "main" Flash SWF (load.swf) with
Flex? Like this:
<mx:SWFLoader source="load.swf" />
?? -
Movie Clip mouse drag at angle
A have a working fader. I can make it move up and down and
give a value 0 - 100. This works great. I would like to have it
move not up and down but at about 30 degrees. I have tried using
motion tweens but i think they only work when you're doing a pre
made animation.
I can change the X and Y limits of the movement but what i
want is this:
for every 3 px up move 1 px left, done in real time, or a
wayt to attach a mouse controlled object to a motion path or guide.
Thanks for any input on this!
Cheers.you can't use startDrag() unless the only constraints you
want are (none or) a rectangular region. you can initiate a loop
and direct any movieclip to adjust its _x, _y properties as a
function of the mouse's _x and _y properites.
in your situation you must decide when to start the
movieclip's movement (probably onPress) and when to terminate
(maybe onRelease, but maybe also when the mouse moves some distance
or greater from the movieclip) and the range of the movieclip's
motion.
Maybe you are looking for
-
HI Expert ! I m using this code . LTIME TYPE SY-UZEIT T1 TYPE SY-UZEIT VALUE 030000, T2 TYPE SY-UZEIT VALUE 050000, BUT WHEN I M USING T1 AND T2 in loop ( if statement ),ITS value r T1 = 082000. t2 = 131100 . if t1(6) t2(6 ) ltime (6 ). then ok
-
Personal videos on Apple TV sound but no picture
Hi, I'm an experienced Mac user but brand new to Apple TV, just arrived yesterday. I have some personal videos not purchased through iTunes that I keep in the iTunes library as "TV shows". They all play fine when I click on them in iTunes at the iMac
-
Lost files in premiere pro after installing photosop
hi, I lost all my premiere pro files after installing photoshop. The same happened probably 3 months ago when I switched from full package subscription to just one program. Any help with that? is there a way to get my files back? I didnt backup my co
-
Panel Tabbed Inter-Region Communication - jdev 11.1.2.3
Hello: I have a page with panel tabbed. In each showDetailItem (TAB) there is a bounded task flow (BTF from ADFLib) that needs to receive employeeID. The employeeID is used as a bind variable for each VO query shown in the tab. When the user clicks
-
Integrate third party libraries with JBuilder 2005
Hi, Does any body know how to integrate any third party APIs with JBuilder 2005. It would be of great help if anybody of you could jot down the steps to integrate third party APIs with JBuilder.I've got to use the JDIC API(https://jdic.dev.java.net)