Targeting movie clip button in a movie clip
Hello
I just can't work this. It should be simple
I'm trying to target a clip in a clip.
I have a clip on the main stage with an instance of a name
I have the following on her action script
on (release) {_root.a.gotoAndStop (2);}
}
The first thing we do is to get the code on objects and place it in the timeline panel. In the timeline root for one button you would use...
a.onRelease = function() {}
a.gotoAndStop (2);
}
Similarly, in structure 2 inside one, where is the other button b...
b.onRelease = function() {}
b.gotoAndPlay (2);
}
Tags: Adobe Animate
Similar Questions
-
Drag and Drop - target movie clip control
Here's what I want to do. Currently, I have a drag and drop built in AS 3, which works perfectly well, but I am looking to add one more feature. What I want to do is when I let fall the correct item drag on its target correct piece, (which is a clip), I want my music video for target to go has a headframe.
I'm so for example dragging a piece of paper on a clip from a waste basket. When I drop the piece of paper on this topic to the trash, the trash clip moves one a headframe that appears a crumpled paper in it.
Here is my current code for my drop eventlistener:
function dropMe(event:MouseEvent):void
{
event.currentTarget.stopDrag ();
If (Event.currentTarget.hitTestObject (Event.currentTarget._targetPiece))
{
event.currentTarget.x = 950;
event.currentTarget.y = 100;
event.currentTarget.removeEventListener (MouseEvent.MOUSE_DOWN, Drachma);
event.currentTarget.buttonMode = false;
}
on the other
{
event.currentTarget.x = event.currentTarget._origX;
event.currentTarget.y = event.currentTarget._origY;
}
}If event.currentTarget._targetPiece points to the instance of wastepaper basket, then I think you should be able to target just by using that...
function dropMe(event:MouseEvent):void
{
event.currentTarget.stopDrag ();If (event.currentTarget.hitTestObject (event.currentTarget._targetPiece))
{
event.currentTarget.x = 950;
event.currentTarget.y = 100;
event.currentTarget.removeEventListener (MouseEvent.MOUSE_DOWN, Drachma);
event.currentTarget.buttonMode = false;
MovieClip (event.currentTarget._targetPiece) .gotoAndStop (2);
}on the other
{
event.currentTarget.x = event.currentTarget._origX;
event.currentTarget.y = event.currentTarget._origY;
}
} -
targeting a clip inside another video clip
IM currently trying to target 2 frame and a movieclip in this image. This method works. But now im trying to target a movieclip within a clip.
This code works by trying to target a movieclip.
cal.onPress = function() {}
gotoAndPlay (2);
message.total = unit1;
}How can I modify this code to find an another movieclip in the message of movieclip?
Thank you
It will not work if you have a movieclip with instance name 'message' that contains another movieclip with instance name "message1" which contains something (perhaps a variable) named total.
What happens when you use...
cal.onPress = function() {}
gotoAndPlay (2);
message.Message1.total = unit1;trace (message.message1.total);
} -
HTML 5 targeting the Mouseover button
Hello
I am new to Adobe using animate.
I'm trying to pause a clip (movie_test1) by passing the mouse over a button (button_2).
But the error:
TypeError: this.movie_test1 is not defined
this.movie_test1.stop();
This is my code:
frequency of var = 3;
stage.enableMouseOver (frequency);
This.button_2.addEventListener ('mouseover', fl_MouseOverHandler_2);
function fl_MouseOverHandler_2()
{
This.movie_test1. Stop();
}
I guess that Im making a rookie mistake.
Any suggestions much appreciated.
Thank you
JavaScript event handlers execute in the global context, not the context in which they are defined, so 'this' point there where is your video clip. There are two solutions to this:
Create a global variable, store a reference to your local context and use in the case of Manager.
myLocalThis = this; this.button_2.addEventListener("mouseover", fl_MouseOverHandler_2); function fl_MouseOverHandler_2() { myLocalThis.movie_test1.stop(); }
Or, use the bind() function to force the event handler to run in the necessary context.
this.button_2.addEventListener("mouseover", fl_MouseOverHandler_2.bind(this));
The bind() method is simpler and generally better. The downside is that it complicates using removeEventListener(), because bind() creates a new instance of the function. http://StackOverflow.com/questions/11565471/removing-event-listener-which-was-added-with-b ind
-
HTTP vs event.target.submitForm Submit button
Dear all,
I have a problem that looks like, I need expert help to the resolve.
I have designed a form with Acrobat, LiveCycle Designer ES 8.2
The plan is people to fill out the form and submit it to a script on a web page.
That is the problem.
When I insert a normal button of HTTPSubmit. This medication works very well. All fields in th are sent, and I can treat them with my script.
However, when I try to make a normal button and add javascript for the click event.
event.target.submitForm ({cURL: "http://mysite/myscript.php", cSubmitAs: "HTML", cCharSet: "utf - 8"});
The form is sent, but no fields are.
As an example of the output of the APPLICATION of table in PHP.
With the regular HTTP submit button, I get:
Table
(
[familyname] = > 1
[SubjectNumber] = > 2
[Site] = > 3
)So that the JavaScript file above, I get:
Table
(
[form1] = > Array
(
[0] = >
))
It looks that the JavaScript file I somehow can not present the actuall fields.
Finally, let me tell you the reason why I still want to use Javascript instead of the regular HTTP Submit button.
My plan is so people can actually change the location where to send the form.
From what I've read if I use a single submit button, the URL must be hard-coded and cannot be changed (selected by the user dynamically)
Whereas if I use javascript so I can easily have a text field where people can enter the site where they want to submit the form and use it.
Thank you very much for your help
Please let me know if you need additional information
Concerning
Tsvyatko
Actually I think you can set the url of a "submit" button. Try using the following FormCalc code:
submitbuttonname.event__click. #submit. #target
= the string entered by the user
The string entered by the user must include "http://" in the front, e.g. http://www.google.com
As long as the code above is executed before pressing the button submit, you should be OK. I have not worked on the JavaScript syntax.
-
Cannot target a movie created with ACE clip name
< code >
Sets up the table of images must be changed for each flash animation
var imagePath:Array = new Array ("ImagesWallPack/1009-t", "ImagesWallPack/1011-t", "ImagesWallPack/1012-t", "ImagesWallPack/1013-T.jpg","ImagesWallPack/1014-T.jpg","ImagesWallPack/1017-T.jpg");
var imageClipsHolder:Array = new Array (); Is a table to contain the required number of clips
var totalImages:Number = imagePath.length;//Calculates how many images there
Create the placeholder movieclips
for (var index = 0; index < totalImages; index ++) {//Creates the real film clips to hold the images
Create a new owner
var imageClips:MovieClip = new MovieClip();
imageClips.name = 'image' + index;
var imageLoader:Loader = new Loader();
imageLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, loadComplete);
imageLoader.load (new URLRequest (imagePath [index]));
imageClips.addChild (imageLoader);
Position the brackets
imageClips.x = index + 30;
imageClips.y = index + 30;
Add the holder to the scene
addChild (imageClips);
}
Temporary function which shows the film layers in the film: for debugging purposes
function showChildren(dispObj:*,_indentLevel:Number):void {}
for (var i: int = 0; i < dispObj.numChildren; i ++) {}
var objisplayObject = dispObj.getChildAt (i);
If (obj is DisplayObjectContainer) {}
trace (padIndent (IndentLevel), obj.name, obj);
showChildren (obj, indentLevel + 1);
} else {}
trace (padIndent (IndentLevel) + obj);
}
}
}
showChildren (stage 0);
function padIndent(indents:int):String {}
var indent: String = "";
for (var i: Number = 0; i < dashes; i ++) {}
Indent += "";
}
return the Indent;
}
< code >
Here is the trace output:
ROOT1 [object MainTimeline]
image0 [object MovieClip]
Instance2 [object Loader]
Image1 [object MovieClip]
instance5 [object Loader]
Image2 [object MovieClip]
trial.8 [object Loader]
image3 [object MovieClip]
instance11 [object Loader]
image4 [object MovieClip]
Instance14 [object Loader]
picture5 [object MovieClip]
instance17 [object Loader]
The display list therefore seems to indicate that I have 6 video clips on the stage.
PROBLEM:
When I try to target video clips of name by adding the following code for example:
Image2. APHA = 0;
I get an error:
1120: access of undefined property image2.
What I don't understand is: image2 is a movieclip and a movieclip has a property of alpha?
What I am doing wrong?If you try to use the name for instances of the target property, then you must use getChildByName("image#"). If you are familiar with AS2, names have been changed in AS3, they aren't just the properties and instance names.
-
What is the difference between staging differ from the target
Hello
My question is what is the diffrence between staging differ from the target and staging of the same target area.
To say:
I'm loading the data from the file to the database table. Usually what happens is it will create temporary tables C$, I$, $ E. C$ table removes the information in the previous table and
Create a new table, and then load the data staging I and then E$ for the error checking. So the question is if I select the option staged are same as target in this
case if load us the data from the target moves or otherwise, to where the data is intended.
Help me in this...
THX,If you set a different transit area of target, and if the scheme of work is on one physical server other than your target schema, you will have more stages.
I recommend your to create your interface twice and compare the generated steps by exploiting.
In the first case (staging = target), the interface will do:
* create and load C$ table in the schema of work related to your target schema
* create and I charge $ table in the schema of work related to your target schema
* load data since I have$ for the target tableIn the second case (different staging of target, and if the scheme of work is located on another server), you will have more steps ("export them")
* create and load C$ table in the schema of work related to your "staging schema" you chose
* create an ANOTHER C$ target table in the schema of work related to your schema. load of the first table of C$
* create and I charge $ table in the schema of work related to your target schema
* load data since I have$ for the target tableIn some cases, you must use "another area gathering that target." For example, your target is a flat file. (you cannot use the staging area of the technology of files, so you will choose a database schema)
-
"set the restart target action" does not work, why?
There is an element of "set the restart target action" in the SDF file. I put it to "run a system definition.
But it does not work. I don't know why. It seems that when the project is canceled, the SystemDefinitionData.nivscfg file is deleted.
Cancel the deployment of will stop the configuration and mark idle.
If you restart the RT target by HW button or through the channel "System of command channels", while the configuration is active, it will start the Setup again after the reboot.
Jiri K.
-
Warning Dialogues - cannot capture the button clicks
Now that I can finally connect to the Simulator with the debugger, I can come back and work on my app!
I'm trying to be on the QNX Dialogue class... specifially the AlertDialogue, that I will use for the warning of use of data like most of you...
I looked at the example code, but for some reason, I can't click on the events of the Dialogue...
Here is my code:
package com.content.modal{ import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import qnx.dialog.AlertDialog; import qnx.dialog.DialogSize; import qnx.display.IowWindow; import qnx.events.DialogEvent; public class AirtimeUsageModal extends Sprite { private var alert:AlertDialog; public function AirtimeUsageModal() { init(); } private function init():void { alert=new AlertDialog(); alert.title="MY TITLE"; alert.message="MY BLURB HERE."; alert.addButton("Quit"); alert.addButton("Acknowledge"); alert.dialogSize=DialogSize.SIZE_SMALL; alert.addEventListener(DialogEvent.DIALOG_BUTTON_CLICKED, alertButtonClicked); alert.show(IowWindow.getAirWindow().group); } private function alertButtonClicked(e:DialogEvent):void { trace("Button Clicked Index: " + e.target.selectedIndex); trace("Button properties Object"+e.target.getItemAt(e.target.selectedIndex)); trace("e.responseBtn" + e.responseBtn); if (e.responseBtn == "Quit") { quitApp(); } else if (e.responseBtn == "Acknowledge") { this.dispatchEvent(new Event("startApp")); } } private function quitApp():void { stage.nativeWindow.close(); } }}
My problem is that I can't capture the click event... my tracks in alertButtonClicked never fire... When I click on a modal button disappears... And I get this in the output:
Response of dialogue show null null
Receipt of RESPONSE from the server: @control 1
BaseDialogService.receiveResponseAny ideas what's happening here?
This is a known bug. Please use EVENT. SELECT a workaround until this has been resolved.
-
resolveNodes to hide the buttons in multiple lines
I have a calendar type screen that has a table (wrapped in a subform) which contains a button on each line. I want to hide these buttons with the click of a button.
The tables and the lines are repeated several times and so I'm sure I need to use resolveNodes to target each line / button.
The hierarchy including the button is contained in is:
Form1
monthForm
monthTable
dayRow
deleteBtn
The hierarchy that the button on which is running the script is located in the East:
Form1
grandTotalForm
grandTotalsComplete
Button1
The following javascript code doesn't seem to work. I had this professional base code before other applications, but I can't understand where this goes wrong.
Form1.grandTotalForm.grandTotalsComplete.Button1::click - (JavaScript, client)
var nodes = xfa.resolveNodes ("form1.monthForm [*].monthTable.dayRow [*]");
var len = nodes.length;
for (var i = 0; i < len; i ++) {}
nodes. Item (i).deleteBtn.presence = "invisible";
}
Has anyone an idea what I am doing wrong? Thanks in advance for any help.
Hi, I think that the error occurs because you use the term "nodes" which is already a property in Livecycle javascript.
Try to call it theNodes
-
How to use the same script for several buttons
Hello
I have just started using flash if any help would be great!
I create a blockbuster game, I have a grid of 20 buttons and I need (individually) to turn blue on red and click double click. I managed to do it with the first using this code;
--------------------------------------------
var click: Boolean = false;
BN1.addEventListener (MouseEvent.CLICK, bn1click);
function bn1click(event:MouseEvent):void {}
clicked = true;
var newColorTransform:ColorTransform = bn1.transform.colorTransform;
{if (clicked)}
newColorTransform.color = 0 x 064258;
}
BN1. Transform.ColorTransform = newColorTransform;
}
/////////////
BN1.doubleClickEnabled = true;
var doubleclicked:Boolean = false;
BN1.addEventListener (MouseEvent.DOUBLE_CLICK, bn1dclick);
function bn1dclick(event:MouseEvent):void {}
DoubleClicked = true;
var newColorTransform:ColorTransform = bn1.transform.colorTransform;
{if (clicked)}
newColorTransform.color = 0xac1e23;
}
BN1. Transform.ColorTransform = newColorTransform;
}
--------------------------------------------
Now, I'll have trouble doing the same thing to work for the rest of the buttons, they are each named bn2, bn3 etc. They need to work individually and stay blue/red when clicked. I tried to list them as addEventListener orders but not with not a lot of success!
Any help would be greatly appreciated, thank you!
Tomo
To do this is to use arrays to follow the buttons and their properties.
var buttonList:Array = new Array (bn1, bn2, bn3);
var clickedList:Array = new Array();
var doubleClickedList:Array = new Array();
Then use a loop for to assign functions and properties for each button:
var thisMany:int = buttonList.length; This will give you the number of items in the buttonList array
for (var i: int = 0; i
buttonList [i] .addEventListener (MouseEvent.CLICK, btnClick); assign the function click on each button
buttonList [i] .addEventListener (MouseEvent.DOUBLE_CLICK, btnDClick); assign the double-click function
clickedList.push (false); Add a value of false for each key in this table
doubleClickedList.push (false);
buttonList [i] .doubleClickEnabled = true; Set the property of double-tap for each button
}
function btnClick(event:MouseEvent):void {}
var thisButton:int = buttonList.indexOf (event.target); know which button has been clicked as an element in the table
clickedList [Ceboutonselectionnel] = true; Change the value in the table
var newColorTransform:ColorTransform is buttonList [Ceboutonselectionnel].transform.colorTransform;.
{if (clickedList [thisButton])}
newColorTransform.color = 0 x 064258;
}
buttonList [Ceboutonselectionnel].transform.colorTransform = newColorTransform;
}
function btnDClick(event:MouseEvent):void {}
var thisButton:int = buttonList.indexOf (event.target);
doubleClickedList [Ceboutonselectionnel] = true;
var newColorTransform:ColorTransform is buttonList [Ceboutonselectionnel].transform.colorTransform;.
{if (doubleClickedList [thisButton])}
newColorTransform.color = 0xac1e23;
}
buttonList [Ceboutonselectionnel].transform.colorTransform = newColorTransform;
}
Now you can have any number of buttons, just add their instance names in the table above.
-
Error #1009 with a movie clip button that is located in a clip
OK, so I have a button in a movie clip of mc causing a great error problem which continues to repeat. My code is extremely simple:
Stop();
infoGraphicDisparity.addEventListener (MouseEvent.CLICK, disparityGO);
function disparityGO(event:MouseEvent):void
{
MovieClip (this.root) .gotoAndPlay ("disparity");
}
I used these types of buttons, a million times, and now CS6 doesn't like it. Any help is very appreciated. Thank you
I have no idea which is MAIN, but...
stage.addEventListener (Event.ENTER_FRAME, enterFrameHandler);
Listener is originally the function that seeks to target the HAND at the rate of your file, and she continues to do if you move in the 2 structure. If there is no HAND in box 2, then it is your source of error. Try to remove this event listener before going to box 2 and the problem should go away.
-
Do away with button movie clip
Hi all
Thank you very much for watching my post and I hope you can answer my question
Basically, I have a 3D interactive project only when the viewer clicks on the window and drag either right or left, then it pops up as they spin a 3D model, I have given out in Maya. What they do moves the mouse over the x axis that causes the clip to play backward or forward.
The code I got from this site works like a dream! I even made sure that as they click a button depending on whether he goes to the other almost identical movie clip and he will leave the same frame as the previous video clip let go. I'm rather proud of myself for the moment
However - on the second clip almost identical (mc_2), it has some tags on the images. And what I really want to do is, press the mouse for labels to disappear and when the viewer has finished breakfast through the time line with the mouse move and break the mouse, who reappear labels!
Looks a lot like now here: http://BMC.Erin.utoronto.ca/~Enid/interactivethyroidectomy/
So, I worked on this code which works perfectly in a small test project I've done. I put this on a button called my_btn and then made a label and this changed to a clip called my_mc and it all worked perfect
on {(press)
_root.my_mc._visible = false;
}
on (release) {}
_root.my_mc._visible = true;
}
But what I really need to do is for my previous movieclip, mc_2, use the code above. However, if I add anywhere amoungst my actionscript previous coding in the mc_2 layer, then the viewer can no longer scrub through the timeline more. Clearly this code above is affected my previous code. which is:
Stop();
mc_2.stop ();
var startX:Number;
var startFrame:Number;
var changeDistance:Number;
var travelDistance:Number;
mc_2.onPress = pressHandler;
mc_2.onRelease = releaseHandler;
mc_2.onreleaseoutside = releaseHandler;
function pressHandler (): Void {}
startX = mc_2._xmouse;
startFrame = mc_2._currentframe;
this.onMouseMove = moveHandler;
}
function releaseHandler (): Void {}
this.onMouseMove = null;
}
function moveHandler (): Void {}
changeDistance = mc_2._xmouse - startX;
travelDistance = startFrame + changeDistance;
If (travelDistance > mc_2._totalframes) {}
mc_2.gotoAndStop (travelDistance % mc_2._totalframes);
} ElseIf (travelDistance < 0) {}
mc_2.gotoAndStop (mc_2._totalframes + (travelDistance % mc_2._totalframes));
} else {}
mc_2.gotoAndStop (travelDistance);
}
}
Just so I'm ultra clear for the various layers etc.
On stage 1, I have four layers
Actions, buttons, clips, video and background
In two, it has the above actionscript and then mc_2
Inside of the mc_2 are 100 images from a view of 360-degree images of a shoulder of Maya
in the top layer of the images, I have labels - one of which ive converted a clip called my_mc to this post.
So what I have to do is add somewhere in the ActionScript for the mc_2 who, with all the mouse, presses and releases for him also make a specific mc (my_mc) invisible when the mouse is pressed and re appear when the mouse is released.
I hope that makes sense.
I thank very you much for your help in advance.
CAT
If you want to target something inside the mc_2, then just target mc_2 in the path...
mc_2.my_mc._visible = false;
-
I need help using the target path tool
Hi all
I realize that I need to keep all my code in the main storyline, so now I need serious help with targeting movieclips and buttons, when I use the target path tool (the viewfinder in the action script Panel) it allows me to navigate to the thing I want, but when I use his suggestion it very often does not work , and I find myself using trial and error to get by. ICAN get stuff to work, but I really have no idea why or how I do it, sorry to be a N00B, but I really think that if I can work that I get somwhere.
See you soon
void
subtlefly72 wrote:
Thanks kglad,.
OK, this is essentially what I did, but its been a bit hit and Miss, but maybe now, I can't see why, your last sentence
of course, all of these objects have which existed at the time your code runs.
So if I'm making refers to something within a mc and it does not exist on the first image, there will be an error?
exactly.
also, what is this. Object() and Object (parent)?
I have to be the use of these?
not when using the code on the main timeline. "This" refers to the current scope, which is for the code in the main storyline, the main timeline. What follows is the same:
This.MC and mc
This.var1 and var1
And again, I want to know why the target tool gives me a path that does not work?
I can't tell you much about the tool to the target. I never used it. but I tried to test this afternoon and it seems to work fine to target a nested movieclip. again, you must ensure that this object exists when your code runs so if you're targeting something on the frame 2 (or more) of a movieclip using the code on frame 1 of the main timeline, the reference may be correct, but the object does not exist when your code runs. There are a number of ways to handle this, if this is your main problem.
-
AS3 putting the buttons inside the Movie Clip
I'm practicing AS3 (after years of AS2) and can't have a button inside of a clip speaks to another clip on the main timeline. Here is the code:
OneButton.addEventListener (MouseEvent.CLICK, OneButtonClicked);
function OneButtonClicked(event:MouseEvent):void
{
MovieTarget.gotoAndStop (1);
MovieDescription.gotoAndStop ("One");
}
TwoButton.addEventListener (MouseEvent.CLICK, TwoButtonClicked);
function TwoButtonClicked(event:MouseEvent):void
{
MovieTarget.gotoAndStop (2);
MovieDescription.gotoAndStop ("Two");
}
The code above works, but if I put OneButton and channels within a clip, I know can target the MovieTarget and MovieDescription. The reason that I want to put OneButton and strings inside it's own MC is so I can dim each hit after top by switching the playhead within this MC help. ? Thank you!
Start from the beginning
Press f8 and choose movieClip, then draw your button movie untoggled call then create another movie and create your button toggled or grayed button and call it greyedButton. Go to the main stage add 2 instances of button and 2 greyedButton (just drag the library). you have 4 instances on stage. give the name of the instances of appeal and place them one over the other so you can see 2 buttons on the stage. put the button greyed under the button.
now with action script
Button1.addEventListener (MouseEvent.CLICK, OneButtonClicked);
function OneButtonClicked(event:MouseEvent):void
{
MovieTarget.gotoAndStop (1);
MovieDescription.gotoAndStop ("One");
Button1.visible = false; Here the button greyed will show
}
Button2.addEventListener (MouseEvent.CLICK, TwoButtonClicked);
function TwoButtonClicked(event:MouseEvent):void
{
MovieTarget.gotoAndStop (2);
MovieDescription.gotoAndStop ("Two");
Button1.Visible = true; Here button1 will return to its orignal State
Button2.visible = false / / here will show the button greyed
}
Maybe you are looking for
-
Why my messages pop up anywhere in my Inbox
When I get a new message it can be saved anywhere in the Inbox between old messages and there is very little space to open the message
-
Firefox does not start when DYLD_FALLBACK_LIBRARY_PATH in launchd.conf
I need to configure DYLD_FALLBACK_LIBRARY_PATH for another application but when I do this Firefox launch more correctly... empty shell resembling Firefox opens. (Located in launchd.conf and requires a reboot) An easy test is to use the Terminal and s
-
How to install firefox 4 on my desktop
How can I go about installing firefox 4 on my desktop, I've not seen a download button.
-
Pavilion dv2 laptop: how to connect as administrator
I used my HP recovery disks to restore my laptop to condition factory & now want to install the updates of Windows (Vista), install programs, etc. Vista updates are installed by Service Pack 2. I have installed/activated Microsoft Home & Student 200
-
Pavilion a130.no Ethernet card drivers?
Friends, Working on an a130 Pavilion where the drive crashed suddenly, I need a driver for the ethernet card on this machine. Time is tight, so to speak, so I hope that I can find and have the PC online before Monday. Check the download page for this