flash mc from library
- Started
- Last post
- 17 Responses
- wwfc
Evening! anyone know the answer to this question?
I have an mc that is brought in from the library - and I have some script that places it into the timeline - my problem is that it is called in on a couple of frames through the timeline - and as the frame changes the mc jumps back to the start of the mc's timeline - I need to make it carry on playing - regardless of the frame the main timeline is on.
I have tried with and without exporting on the first frame etc... and also placing it just off the stage with a relevant instance name - but it still jumps back to frame one of the attached movieclip!
What should I do to just make it recognised as the same mc and carry on playing the loop?
Is it possible? I am using AS2 for this, so preferably AS2
- d_rek0
sounds like you shouldn't be calling the MC again from the timeline; rather you should be telling the MC to stop when you need it to. You can probably do this several different ways but the first that pops into my mind is an if statement.
- uan0
or maybe youre instancing it everytime the main-timeline loops...so the mc restarts every time its intanced....but not sure if i get the problem right.
- fyoucher10
Why not nest your timeline animation in it's own movieclip. Attach both mc's and then control separately....right now it sounds like you're attaching a mc into an animated timeline...
- wwfc0
...yeh, kind of - the timeline is staggered by a series of keyframes, and on each is call for mc to be attached as part of a longer batch of script - is there a way of checking what is there - and if that mc is already attached then leave it be and not treat it like a fresh attach?
- wwfc0
...this is the line that calls for the attach...
menu.attachMovie("centre_mc","ce... 150, {_x: 300, _y: 100});
Is there another way of doing that? But just checking that it is there already and leaving it there?
- mikotondria30
if ( menu [ ' centre_mc ' ] ) {
//do as above
- wwfc0
sounds good to me! - just strip that into the script? before or following my line?
- mikotondria30
I would think just above, and after your movie adding, just close it off with a close curly-brace..
I will say at this point, that the above is just my 1st instinctive attempt, and that of course, like every other flash coder, I have spent many hours going round and round apparantly simple code that doenst work for no good reason known to man, until you spot the simple mistake and then it does.
- mikotondria30
see - like that, just then -
we dont want to check if the new MC IS there, we only want to do it if it's NOT there, so :
if ( ! menu [ ' centre_mc ' ] ) {
- wwfc0
cheers mikotondria3 I'll give it a shot and see what happens ;-)
ou1
- wwfc0
...hmm - not doing it this end - but I am probably missing the hol point somewhere!
//create menu items: attach from Library via linkageID and populate text label
for(var i=0;i<numOfItems;i++)
{
var mc = menu.attachMovie("planet" + (i+1),"item"+i, menu.getNextHighestDepth());
mc.txt_label.text=arrItems[i];
mc.angle = i * sectorDistance;
mc.id = i;
mc.filters = [colorMatrixGrey_filter, blurFilter];//modified this to now have TWO filters
mc.onRelease = released;
if (menu["centre_mc"]) {}
menu.attachMovie("centre_mc","ce... 150, {_x: 300, _y: 100});
}that is the block I have it in..
- fyoucher10
take out quotes around centre_mc
- wwfc0
...aah! k! ;-)
- wwfc0
...still struggling with this - I have the centre_mc loading - great - but it keeps jumping back to the first frame of the centre_mc - I want it to carry on playing, this is what I am using...
//create menu items: attach from Library via linkageID and populate text label
for (var i = 0; i<numOfItems; i++) {
var mc = menu.attachMovie("planet"+(i+1), "item"+i, menu.getNextHighestDepth());
mc.txt_label.text = arrItems[i];
mc.angle = i*sectorDistance;
mc.id = i;
mc.filters = [colorMatrixGrey_filter, blurFilter];//modified this to now have TWO filters
mc.onRelease = released;
if (menu.centre_mc._alpha == undefined) {
menu.attachMovie("centre_mc","ce... _y:100});
}
}
- wwfc0
that script is part of a longer block of code - and appears on numerous frames - each frame has alternate references to other mc's but this always stays the same - how can I tell to check th movieclip and leave it running it's own timeline and not jump to frame 1 of the mc?
- thatblokemike0
if (menu["centre_mc"]) {
menu.attachMovie("centre_mc","ce... 150, {_x: 300, _y: 100});
}in your code above that you couldn't get working you were putting the curly braces in the wrong place.. see my example.. re-implement as i see you had removed it the second time round. and remove that alpha check.. stupid.. when will alpha ever be undefined?
- ahh.. if it doesnt exist.. nasty way to do it thoughthatblokemike
- wwfc0
....what is frustrating is that the mc I am calling 'is' always the same - so logically it should just carry on playing - it never goes off stage once it is brought in - but I need to call it with each block of script as the central point - otherwise I'd just drop it onto the stage.