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 much
hi,
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)...
Similar Messages
-
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)... -
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 -
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. -
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/ -
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. -
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. -
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.. -
Attach movie clip speed increase after 2 min
i am making a game in falsh as2
see this link to understand http://createview.in/try/game.html
this function for one fruit.
so there are 10 functions i want to increase speed of falling fruits after 2 min for making difficulties to user
makegd is function for bonus golden fruit it will come every 3 min
PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!
function makeOne() {
if (seconds>0) {
clearInterval(ranOneID);
ran = (Math.random()*10000+8500);
ranOneID = setInterval(makeOne, ran);
One = _root.attachMovie('n_red', 'n_red'+depth, depth++);
nBalls.push(One);
//trace(allBalls);
One._x = Math.random()*500;
One._y = -350;
One.speed = (Math.random()*3)+2;
One.onEnterFrame = function() {
this._y += this.speed;
if (this._y>Stage.height+100) {
//updateScore(-5);
black=black+1;
for (i=0; i<allBalls.length; i++) {
if (this == allBalls[i]) {
allBalls.splice(i, 60);
this.removeMovieClip();
if(this.hitTest(slider_mc.kat)){
red = red+1;
function makegd() {
if (seconds>0) {
clearInterval(rangdID);
rangdID = setInterval(makegd, ran);
gd = _root.attachMovie('golden', 'golden'+depth, depth++);
goldenBalls.push(gd);
//trace(allBalls);
gd._x = Math.random()*500;
gd._y = -100;
gd.speed = (Math.random()*8)+3;
gd.onEnterFrame = function() {
this._y += this.speed;
if (this._y>Stage.height+100) {
//updateScore(-5);
for (i=0; i<allBalls.length; i++) {
if (this == allBalls[i]) {
allBalls.splice(i, 1);
this.removeMovieClip();
makeOne();
makeTwo();
makeThree();
makeFour();
makeFive();
makeSix();
makeSeven();
makeEight();
makeNine();
makeTen();
setTimeout(makegd,180000);Thank you Kglad for your quick response.
one thing that not happen
makegd is function for bonus golden fruit it will come every 3 min
it comes after 3 min but it's not single fruit that function work like other fruits.
function makegd() {
if (seconds>0) {
clearInterval(rangdID);
rangdID = setInterval(makegd, ran);
gd = _root.attachMovie('golden', 'golden'+depth, depth++);
goldenBalls.push(gd);
//trace(allBalls);
gd._x = Math.random()*500;
gd._y = -100;
gd.speed = (Math.random()*8)+3;
gd.onEnterFrame = function() {
this._y += this.speed;
if (this._y>Stage.height+100) {
//updateScore(-5);
for (i=0; i<allBalls.length; i++) {
if (this == allBalls[i]) {
allBalls.splice(i, 1);
this.removeMovieClip();
setTimeout(makegd,180000); -
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; -
Unloading a movie clip from a for statement
Hi,
I have this code:
//create empty movie clips to place bin top, flame and bin
bottom in that order
this.createEmptyMovieClip("holder_mc2",this.getNextHighestDepth());
this.createEmptyMovieClip("holder_mc",this.getNextHighestDepth());
this.createEmptyMovieClip("holder_mc1",this.getNextHighestDepth());
//attach movie clip/variables
var dsfInstance:DropShadowFilter = new DropShadowFilter(5,
45, 0x000000, 1, 10, 10);
var b:MovieClip =
holder_mc2.attachMovie("binTop_mc","binTop_mc",holder_mc2.getNextHighestDepth());
var a:MovieClip =
holder_mc1.attachMovie("binBottom_mc","binBottom_mc",holder_mc1.getNextHighestDepth());
//property values
a._x = 419;
a._y = 244;
a._width = 112.0
a._height = 140.0
b._x = 419;
b._y = 175;
b._width = 112.8;
b._height = 10.1;
a.filters = [dsfInstance];
//create for loop to place the flame particle on the stage
many times
for(i=0;i<200;i++){
//places in temporary movieclip t
var t:MovieClip =
holder_mc.attachMovie("flame","flame"+i,holder_mc.getNextHighestDepth());
// position the movieclip on the stage for y co-ordinates
t._y = 190;
t._x = Math.random()*80+(Stage.width/2+115);
//give the flame random sizes no larger than 80 pixels and no
smaller than 20
t._xscale = t._yscale = Math.random()*80 + 20;
//randomize the frame the movieclip is going to start in the
flame movie clip is 16 frame long so it will pick number between
that
//because math.random produces decimal values we round the
number using math.ceil to the high whole number
t.gotoAndPlay(Math.ceil(Math.random()*16));
what i want to do is remove the movieclip in the for loop off
the stage when i click on a button. i can manage to remove the
movie clips with the variables a and b but i cant do it with the
one in the for loop.
i put this code in the button:
on(release){
play();
stopAllSounds();
a.removeMovieClip();
b.removeMovieClip();
t.removeMovieClip();
Is there a way to do this?im so dumb! i figured it out.
i used the "holder_mc" the name of the empty movie clip.
holder_mc.removeMovieClip(); -
Dynamically adding multiple instances of a movie clip to the stage with one button
hello,
I was wondering if there was a way to add several instances
of the same movie clip to the stage dynamically utilizing one
button.
I can do one with the following code placed on the button...
on (release) {
attachMovie ("filledCircle", "filled1", 5);
filled1._x = 370;
filled1._y = 225;
But I want the user to be able to hit the button again and
get yet another instance of "filledCircle" on the stage.
I also want the user to be able to drag these instances
around...
Any help would be appreciated...
Thanks,
MuhlMuhl,
> I was wondering if there was a way to add several
> instances of the same movie clip to the stage
> dynamically utilizing one button.
Sure thing.
> I can do one with the following code placed on the
> button...
>
> on (release) {
> attachMovie ("filledCircle", "filled1", 5);
> filled1._x = 370;
> filled1._y = 225;
> }
Gotcha.
> But I want the user to be able to hit the button again
> and get yet another instance of "filledCircle" on the
> stage.
You're in luck, because this isn't very hard to do. The main
thing to
keep in mind is that each instance must have A) its own
unique instance name
and B) its own unique depth. In your example, the instance
name is filled1
and the depth is 5. The next clip's instance name should be
filled2 at a
depth of 6. Then filled3, depth 7, and so on. You can use a
single
variable to handle the incrementation.
// code in a frame
var counter:Number = 1;
// code on your button
on (release) {
attachMovie ("filledCircle", "filled" + counter, counter +
4);
With me so far? The variable counter contains the numeric
value 1. The
second parameter of attachMovie() is provided with a
concatenation of
"filled" + 1, which makes "filled1". The third parameter is
provided with
the sum of counter plus 4, which makes 5. Obviously, we need
a bit more.
The button must, in addition, increment the value of counter.
The ++
operator handles this perfectly.
on (release) {
attachMovie ("filledCircle", "filled" + counter, counter +
4);
counter++;
Now, it seems you also want to position the attached movie
clip to (370,
225). Are they call supposed to go to the same place? If so,
you may use a
second variable to hold a reference to the newly attached
clip. Look up
MovieClip.attachMovie(), and you'll see that the method
returns the exact
reference you need.
// code in a frame
var counter:Number = 1;
var mc:MovieClip;
// code on your button
on (release) {
mc = attachMovie ("filledCircle", "filled" + counter,
counter + 4);
counter++;
mc._x = 370;
mc._y = 225;
Make sense?
> I also want the user to be able to drag these instances
> around...
Then you need to handle a few events. You're dealing with
movie clips
here, so your best bet is to study up on the MovieClip class,
which defines
all movie clips. (Note, also, that the TextField class
defines all input
and dynamic text fields; the Sound class defines all sounds,
etc. This is a
very handy arrangement of the ActionScript 2.0 Language
Reference.)
// code in a frame
var counter:Number = 1;
var mc:MovieClip;
// code on your button
on (release) {
mc = attachMovie ("filledCircle", "filled" + counter,
counter + 4);
counter++;
mc._x = 370;
mc._y = 225;
mc.onPress = function() {
this.startDrag();
mc.onRelease = function() {
this.stopDrag();
Easy as that. You're simply assigning a function literal to
the event
of each new MovieClip instance as you create it. Take a look
and you'll see
each of these class members available to you -- that is, to
all movie clips.
MovieClip.onPress, MovieClip.startDrag(), MovieClip._x, etc.
Wherever it shows the term MovieClip in the Language
Reference, just
replace that with the instance name of your clip -- or a
reference to that
clip (which even includes the global "this" property).
David
stiller (at) quip (dot) net
Dev essays:
http://www.quip.net/blog/
"Luck is the residue of good design." -
Buttons in an attached movie from library
I used the tutorial posted at
http://www.layersmagazine.com/flash-attaching-movieclips-actionscript.html
Now I have a button on my stage that attaches a movie from the
library.
on (release) {
this.holder.attachMovie(“contents”,”contentslinks”,1);
It works fine but I also have buttons inside the attached
movie clip that need to control a movie that is already on the
stage.
contentslinks.contents_link_1.onRelease = function() {
content_mc._visible = false; book_mc.directGotoPage(4);
If I just place the attached movie on the stage the buttons
work but I when I proceed to use attachMovie, they do not work. How
do I get the buttons in the attached movie to address the movie
that is already on the stage?you can use the enabled property of movieclips to
enable/disable them.
Maybe you are looking for
-
Can't seem to report an app that I keep getting charged monthly for.
First, I love Apple products. I've owned them for years. I currently own a new Macbook Pro, Apple TV, Ipad 2 and some other products. A few months ago, I downloaded a free app called KDrama. It streams korean videos and since my wife is korean, I tho
-
dear all I want to create rsa private key from .key file. I searched a lot but could not find a way to do so. how can i do that ???
-
Hi, I was given an ipad 2 by my company and it came with the 2 pin European charger, what i would like to know is it possible to buy the slide off part of the charger and replace it with the slide on 3 pin UK charger? If so does anyone know where i c
-
Dear All, Is it possible to search for POs based on GL Account? Tried looking under dynamic selections but GL Account is not there.
-
hi i want to delete material which is not being used for long time stored in a storage location. what is the process and is report to delete material based on storage location and plant