-
how do i, having created a limited number of mc's then attatch an actionscript to those mc's that refer to only themselves...? You follow. Check the code below
This is the code i want to attatch to the mcs
Code:
onClipEvent (load) {
trgtx = this._x;
trgty = this._y;
}
on (press) {
this.startDrag();
_alpha = 40;
i=0;
}
on (release, releaseOutside) {
this.stopDrag();
_alpha = 100;
i=1;
}
onClipEvent(enterFrame){
if(i!=0){
floatTo(this, 2, trgtx, trgty);
}
}
see post below for a clearer explanation
Any ideas?
[Edited by buggedcom on 09-03-2002 at 07:48 PM]
-
its simple in MX
hi dude,
I didn't get your problem but anyhow i feel, All that you have to do is write the code in the timeline instead of writing the code in the objects(MC's).
_root.abc1.onLoad=function(){
your code
..............
..............
}
here abc1 is the MC's instance name and its placed in the root.
hope that helps U
gnana
-
ah ok, this is good, I thought as much this is why i inserted this code
Code:
path["thumb"+seed].onLoad = function() {
trgtx = path["thumb"+seed]._x;
trgty = path["thumb"+seed]._y;
};
path["thumb"+seed].onPress = function() {
startDrag(this);
_alpha = 40;
};
path["thumb"+seed].onRelease = function() {
stopDrag();
_alpha = 100;
i = 1;
};
path["thumb"+seed].onReleaseOutside = function() {
stopDrag();
_alpha = 100;
i = 1;
};
path["thumb"+seed].onEnterFrame = function() {
if (i != 0) {
floatTo(path["thumb"+seed], 2, trgtx, trgty);
}
};
where path["thumb"+seed] = _root.empty.thumb1, but you see the problem arises out of the use of 'seed'. It is part of a cycle that dynamically creates empty mcs in the path directory. Thus every time the cycle restarts seed = seed+1 so the script will stop applying to
_root.empty.thumb1
and start applying to
_root.empty.thumb2
etc etc untill the cycle stops and then it will only apply to the final mc that was created.
Do you follow?
I need a script that calls all the created mc's and controlls them with one script, but they have to behave independant of one another. ie i have to be able to drag one without dragging them all.
I'm having a go at this with creating an array with all the created mc paths in it.
path["thumb"+seed].thumbArray[seed-1]=""+path["thumb"+seed]+"";
This is in a loop, so every time seed gets updated a new value is added to the array. Being not very good with arrays i do not know how to script the array so i get it to apply all the paths to the the above code in one cycle of the script.
Any ideas on that?
-
Still don't find ur problem
hi dude,
I understood that you have many movieclips and want to give drag and drop feature to individual MC's. What is the problem in it
the below code gives U an idea of how individual codes can be set drag option
//---------code starts here----------
//creating empty movie clips
_root.createEmptyMovieClip("new1_mc",2)
_root.createEmptyMovieClip("new2_mc",3)
// drawing a line in the movie clips just to see the mcs
_root.new1_mc.moveTo(100,100)
_root.new1_mc.lineStyle(2,"ff0000",100)
_root.new1_mc.lineTo(130,120)
_root.new2_mc.moveTo(200,200)
_root.new2_mc.lineStyle(2,"ff0000",100)
_root.new2_mc.lineTo(230,220)
//setting the code for the events for the MCs
_root.new1_mc.onPress=function(){
this.startDrag(false)
}
_root.new1_mc.onRelease=function(){
this.stopDrag()
}
_root.new2_mc.onPress=function(){
this.startDrag(false)
}
_root.new2_mc.onRelease=function(){
this.stopDrag()
}
//---------code ends here
gnana
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|