On click remove attached movie clip
i wnt to onclick remove on satge movieclip
i apply this code on button thats not working!!!!!!!!!!1
on(release){
slider_mc.removeMovieClip();
gotoAndStop(121);
_root.attachMovie('slider', 'slider_mc', -1);
slider_mc._y = Stage.height-182;
var speed:Number = 12;
slider_mc.onEnterFrame = function() {
if (Key.isDown(Key.LEFT) || Key.isDown(65)) {
slider_mc._x -= speed;
if (slider_mc._x>=60.0) {
slider_mc._x -= speed;
if (slider_mc._x<=695) {
slider_mc._x += speed;
if (Key.isDown(Key.RIGHT) || Key.isDown(68)) {
slider_mc._x += speed;
Similar Messages
-
Hi,
On the main timeline, I have the following code:
external_btn.addEventListener(MouseEvent.CLICK, showMenu);
function showMenu(e:MouseEvent):void
var myMovieClip:MovieClip = new Member();
addChild(myMovieClip);
myMovieClip.x = 597.95;
myMovieClip.y =359.15;
in the internal movie clip, that I linked it to Member:
In the member movie clip, I have the following code to remove the movie clip that was created in the main timeline of the root movie clip.
release1_btn.addEventListener(MouseEvent.CLICK, goBack1);
function goBack1(e:MouseEvent):void
MovieClip(root).removeChild(myMovieClip);
I received the following compiler error:
1120: Access of undefined property myMovieClip.
Please help me know how to resolve this error message.
Thanks,
Robert.that's (coding on more than one timeline) not good coding style, but this will correct your error and the prevent a few more:
release1_btn.addEventListener(MouseEvent.CLICK, goBack1);
function goBack1(e:MouseEvent):void
MovieClip(this.parent).removeChild(this); -
Attach movie clips to scrollPane using attachMovie
Hi
I tried to attach movie clips to scrollPane using attachMovie
but could not do it
I tried the following code:
sp.contentPath="emptyMovieClip"
sp.content.attachMovie("boxesRow","boxesRow1",1)
trace(sp.content.boxesRow1)
Im able to trace the sp.content.boxesRow1 , but not seen in
the scrollPane
Can any one suggest me , how can I do this
Pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
Thank you very muchhi,
The code is correct....
But, what i want to know is, are using the Identifier name of
the moviclips ???
"emptyMovieClip" should be an Ideintifier name for an empty
clip in the library.
and "boxesRow" should refer an identifier name of another
movie clip in the library...(its should also contain some object
for the visibility check)... -
Attach Movie Clip to ScrollPane
Hi
I tried to attach movie clips to scrollPane using attachMovie
but could not do it
I tried the following code:
sp.contentPath="emptyMovieClip"
sp.content.attachMovie("boxesRow","boxesRow1",1)
trace(sp.content.boxesRow1)
Im able to trace the sp.content.boxesRow1 , but not seen in
the scrollPane
Can any one suggest me , how can I do this
Thank you very muchhi,
The code is correct....
But, what i want to know is, are using the Identifier name of
the moviclips ???
"emptyMovieClip" should be an Ideintifier name for an empty
clip in the library.
and "boxesRow" should refer an identifier name of another
movie clip in the library...(its should also contain some object
for the visibility check)... -
Attaching movie clips to other movie clips
I have mc1 nested like this
_root.mc3.mc2.mc1;
If i want to attach the mc1 from within mc2 timeline to the
_root timeline how can I do this?... I don't want to reattach it
from the library it must be the nested mc1 that is attached to the
root timeline.
Is there a way to attach movie clips to other m.c's in this
way?
regards JI've spent nearly a year creating this site... I just taken a
glance at AS3. And sizeable isnt wrong... mamouth is closer. Other
than having to learn AS3 it would take me months to rewrite
everything. Is AS3 actually that much better than AS2? Either way
im gonna finish the site in AS2 and try and find a work around for
my attaching mc's to other mc's. Maybe one day I will convert it,
but it just looks like an unnecissary headache.
Thanks for your help. J -
Hi,
Is there a code to remove all movie clip when a button is
press? Sorry. Im new to AShey Scruffy - as I mentioned in your other post it will
depend on how these clips were brought to the Stage to a certain
degree. to be safe one should go ahead and use swapDepths first and
then iterate through all MCs within the swf, as in the following: -
Hello i asked this in my another topic but that topic was
mainly related with another problem.
my question is;
i have 3x3 square boxes ( "box_mc"s movie clips duplicated
from 1 "box" movie clip on stage)
I want to put a small box (that is movie clip "smallmc") in
front of bigger one(that is one of another mc "box_mc" already
placed on stage). When i click big box( i mean "box_mc") i want to
attach an instance of "smallmc" in front of big one.
i have this code in "box" mc ;
on (press) {
if (this.selected == 0) {
trace("box is selected");
selected = 1;
_root.attachMovie("smallmc","smallmc"+count,getNextHighestDepth(),{_x:this._x,_y:this._y} );
_root.count++;
trace(_root.count);
} else {
trace("unselected");
selected = 0;
_root.count--;
trace(_root.count);
but this code puts "smallmc" under "boxmc" :(( and 1 more
problem ;
i have 3x3 big boxes; and when i click a "boxmc" it puts 1
smallmc then i click another "boxmc" it puts "smallmc" but previous
one dissappearing.(but this is not prior problem i think first i
should put small boxes in front of big ones)
thank you for your all helps advicesNot sure if this will help but: getNextHighestDepth() is not
a standalone
method - it is a method of a MovieClip. You need something
like:
this.getNextHighestDepth() instead.
Dave -
Adobe Community Expert
www.blurredistinction.com
http://www.adobe.com/communities/experts/ -
Attach movie clip + INVISIBLE
hey,
is there a way to attach a movie clip and make the object
INVISIBLE (i.e. make the object's alpha 0 as it is attached).
here's the line of code to attach the clip:
holder.attachMovie("frame1", "frame1_mc", 20, {_x: 30, _y:
35});
-donkeyboyyou can set any additional properties inside your brackets:
holder.attachMovie("frame1", "frame1_mc", 20, {_x: 30, _y:
35,_visible:false})
or
holder.attachMovie("frame1", "frame1_mc", 20, {_x: 30, _y:
35,_alpha:0}) -
Attach movie clips using seperate functions
I'm having a little trouble with the following code. I'm
calling two functions: init() and inittwo() to attach some movie
clips to the stage. If I comment one of them out, the other works
fine and the movement is okay. But as it is, only the "cloud" movie
clips are being attached. I need for the clips in the "dreamarray"
to be attached, and then for the "clouds" to be attached with a
second function. I'm probably not going about this the right way,
but I could sure use some help!
It would also be cool if I could attach the dreams at set "x"
values instead of random distribution. I'm not sure how to set a
seperate x value for each item in the array being attached.
var numClouds:Number = 10;
var fl:Number = 250;
var gravity:Number = .5;
var vx:Number = 0;
var vy:Number = 0;
var vz:Number = 0;
var friction:Number = .97;
var vpX:Number = Stage.width / 2;
var vpY:Number = Stage.height / 2;
var vpY:Number = 400;
var dreamarray:Array = new Array();
dreamarray[0] = "dreamone";
dreamarray[1] = "dreamtwo";
dreamarray[2] = "dreamthree";
init();
inittwo();
function init() {
for (var i:Number = 0; i<dreamarray.length; i++) {
var dream:MovieClip = attachMovie(dreamarray
, "dreamarray" + i, i);
//var dream:MovieClip = attachMovie("dreamone", "dreamone" +
i, i);
dream.x = Math.random() * 1600 - 800;
dream.y = 50;
dream.z = Math.random() * 800;
//trace("functioncall");
//tree.x = Math.random() * 2000 - 1000;
//tree.y = 50;
//tree.z = Math.random() * 10000;
function inittwo() {
for (var j:Number = 0; j<numClouds; j++) {
var cloud:MovieClip = attachMovie("cloud", "cloud" + j, j);
//tree.x = 400;
cloud.x = Math.random() * 1600 - 800;
cloud.y = 50;
cloud.z = Math.random() * 800;
function onEnterFrame():Void {
if(Key.isDown(Key.UP))
vz -= 1;
else if(Key.isDown(Key.DOWN))
vz += 1;
if(Key.isDown(Key.LEFT))
vx += 1;
else if(Key.isDown(Key.RIGHT))
vx -= 1;
if(Key.isDown(Key.SPACE))
vy += 1;
vy -= gravity;
vx *= friction;
vy *= friction;
vz *= friction;
for (var i:Number=0;i<dreamarray.length;i++) {
//i think there is a error here
var dream:MovieClip = this["dreamarray" +i];
dream.x += vx;
dream.y += vy;
dream.z += vz;
if(dream.y < 200)
dream.y = 200;
vy = 0;
if (dream.z <= -fl) {
dream.z += 1000;
else if(dream.z > 1000 - fl)
dream.z -= 1000;
var scale:Number = fl / (fl + dream.z);
dream._xscale = dream._yscale = scale*100;
dream._x = vpX + dream.x * scale/2;
dream._y = vpY + dream.y * scale/2;
//dream._x = dream.x * scale/2;
dream._alpha = scale * 60 + 40;
dream.swapDepths(-dream.z);
for (var j:Number=0;j<numClouds;j++) {
var cloud:MovieClip = this["cloud" + j];
cloud.x += vx;
cloud.y += vy;
cloud.z += vz;
if(cloud.y < 50)
cloud.y = 50;
vy = 0;
if (cloud.z <= -fl) {
cloud.z += 500;
else if(cloud.z > 10000 - fl)
cloud.z -= 10000;
var scale:Number = fl / (fl + cloud.z);
cloud._xscale = cloud._yscale=scale*200;
cloud._x = vpX + cloud.x * scale;
cloud._y = vpY + cloud.y * scale;
cloud._alpha = scale * 60 + 40;
cloud.swapDepths(-cloud.z);Hi Ive just taken a very quick look at your code and Ive
noticed at least one or two mistakes.
you are calling:
init();
inittwo();
before the actual functions have been declared.
Flash works from top to bottom when actioning code so by
calling:
init();
inittwo();
bofore the function has been declared and this will do
nothing as it cannot find the functions to call as they have been
declared AFTER the function calls.
The best thing to do is put any calls right at the bottom and
then you will know everything is ready to be triggered. -
Hi,
I have a movie clip to which I attach several others always
at the same depth so one replaces the other. I was trying to change
the size of the attached movies by setting the ._width and ._height
properties and also by using the xscale without any luck. I finally
experimented with a tutorial example and got it to work and saw
that the only difference between the code in the example and my own
was the depth which I had set to 1 and the tutorial had set to 0. I
changed my depth to 0 and it worked.
I didn't see anything specifying that the depth had to be 0
and believe I am still missing something. If anyone cna help me
figure out what's going on I would appreciate it.
Thanks
ChrisFrom the location of the code, the relative path to newSlide
is
full_mc.newSlide as newSlide is in full_mc.
Thus you want:
function updateStage() {
full_mc.attachMovie(mySlide, "newSlide", 0);
full_mc.newSlide._width = 561;
full_mc.newSlide._height = 421;
full_mc.newSlide._x = 0;
full_mc.newSlide._y = 0;
Also note that you can do:
full_mc.attachMovie(mySlide, "newSlide",
0,{_x:0,_y:0,_width:561,_height:421});
Look up attachMovie for the optional initObect
parameter. -
So I want to have a movie clip appear on the screen when I
click the mouse. So i click all over the screen and there are movie
clips everywhere.
Then when I click A, I want another movie clip to appear in
each movie clip, and move across the screen.
I can get the second movie clip to appear ontop of the first
movie clip, but only the most recently placed one will move.Thanks for the feedback, you helped me figure it out.
Ultimately is was the linkage that was the issue. I had them linked
as "01", and "02" etc.
All I had to do was change the link names to "1" and "2" and
presto! Thanks for your help.. -
How can i remove a movie clip container
Hallo friend,
I am dealing with this problem.
In the first frame of my project i am designing a movie clip
dynamicaly - with action script 2 - which i use as a container in
order to fill it with attachments to other movie clips and with
text boxes which i make dynamically too.
The problem is that i want to delete this container in order
to have a quickly way to delete the object that contains, but i
can't find a way to do this.
I have tried the functions removeMovieClip() and
unloadMovie(), but there was no result.
Please, can somebody help me with this ?Friends forgive me for my absence but i do had a very
defficult period, as i wal looking for new job.
Enyway, now i have time and tommorow i will post the code, in
order to let you understand the way i build it.
My friend, uomodicuore2 i use the correct path to the
function unloadMovie() and removeMovieClip()
Friend ric5611 i don't use flash components -
Attaching Movie Clips at runtime from library
Dear All,
I have 6 different clips in Library with the Linkage class
given to following names: Class: mc0, mc1, mc2, mc3, mc4, mc5, mc6,
And I want to attach these clips dynamically at run time
using the for loop in AS3.0:
For( var i=0; i<6; i++)
What should be the code for this at runtime attachment?
Regards,
Sridhar BI looked to see if I could find a way to do this, and
convinced myself it's not possible. If it's important to do this in
a loop (I can't imagine why, but maybe you have a reason) you may
wish to add them explicitly with addChild(mc1) etc but locating
them "off stage" then you can reference them with this["mc"+i] in a
loop to change their coordinates to put them on stage. -
Attaching movie clips to buttons
I would like to design a portfolio site in which I have small
buttons that, when moused over, they display, a pic just above it.
Each button triggers a different pic above it.The best way to go about doing is is to use the MovieClip
class instead of the button class. Use the onRollover event. For
example, have a movie clip that displays the image on the second
frame. The use the actionscript: nameOfMovieClip.onRollover =
function():Void {
this.gotoAndStop(2);
If you want to use the button class to accomplish the same
task, then you will have to create an image that you want to
display then under the "over" frame of the button, place the image.
If you want the original image to be there and display the new
image, then just add a new layer and put the image in the new layer
while keeping to original layer. -
Removing a movie clip from the stage - need help
I am learning AS3 after using AS2 for a long time. I'm making progress but need help. I have a simple Flash website with the sections laid out the timeline with labels. In one section called Media, I have a movie instance of a Flash movie gallery player. It loads just fine but when I leave that section to go to another, the sound of the video is still playing. Visually it's not seen but the sound still plays. I suspect I need to put some sort of remove commamnd in the script but I'm having trouble getting the right result.
I appreciate any help I can get with this.
Thanks!
BCSee if the following posting helps...
http://forums.adobe.com/thread/754549?tstart=0
Maybe you are looking for
-
Time Capsule and Airport Extreme in different modes (n vs. g/n)
Hello, I already have an Airport Extreme. I am very much looking forward to buying the new Time Capsule when it becomes available. Can I set up these two to create one wireless network so that the Time Capsule is n only and the Extreme is g/n? Withou
-
Is there a way of listing all the current keyboard shortcuts?
Within a program is there a way of listing all the current keyboard shortcuts , in a sensible order? I mean in shortcut order, giving the name of the menu option (or other function) alongside. I often want this when I"m about to define my own keyboa
-
I've attached a Gigaware microphone to my Mac Mini, it doesn't seen to recognize the microphone, is this a compatibility issue ?
-
How to capture PKID after insert in Oracle
All-- Please help. This is a general question about Oracle in general, in the hope that someone has solved this problem. I want to capture the PKID after an insert into Oracle. I expect that this is just a syntax issue. I use DataAdapter.Update() pas
-
The sequence number of message
Hello Experts, On the target message we have a field where the message sequence number have to be saved. So the question is how we can do that? Is there is some global storage to save the counter? I guess JAVA-sections and GlobalContainer will not wo