PDA

View Full Version : [FMX] preloading and mc comunication question



icicle
February 25th, 2003, 06:36 AM
i'm making a preloading in which the animation is a mc externally loaded. but the problem is that i would syncronize the percent loaded and the position (frame number in the time line) on the mc loaded.
The percent preloading work fine, but i can't comunicate with mc that remain in it's first frame.
------------------------------
in the main movie
on the first frame:

flag = 0;
i = 0;
CreateEmptyMovieClip("mc", 2);
loadMovie("mcarica.swf", "mc");

on the second:

i = i++;
flag = 100-i;
bytes_loaded = Math.round(getBytesLoaded());
bytes_total = Math.round(getBytesTotal());
getPercent = bytes_loaded/bytes_total;
varloadtxt = Math.round(getPercent*100)+"%";
vaia=((bytes_total/100)*i)
if (bytes_loaded <= vaia) {
_root.mc.gotoAndStop(i);
}
if (bytes_loaded == bytes_total) {
gotoAndPlay("Scena 1", 1);
unLoadMovie("mc")
}

on the third:

gotoAndPlay(2);
----------------------------

my mc (called "mc" :-) is on second and third frame (only the second is the keyframe).

what's my error????????? please help me!!!!!

bye icicle

Dravos
February 25th, 2003, 06:53 AM
gotoAndPlay("Scena 1", 1);

Does this refer to the mc?
try:


mc.gotoAndPlay("Scena 1", 1);

Dravos
February 25th, 2003, 06:55 AM
Sorry me being stupic your refering to the next scene in the root mc

Try unloading the mc before you move to next scene

icicle
February 25th, 2003, 07:09 AM
4 davos: i've unloaded my mc.

my error should be in the first condition:
----------------------------------------------------
if (bytes_loaded <= vaia) {
_root.mc.gotoAndStop(i);
}
--------------------------------------------------------
the second work fine.
It's correct use i as index?

ahhhhhhhhhh

Dravos
February 25th, 2003, 07:31 AM
i=i++ ;
wont do anything, if you want to increment its just


i++;



how many frames are there in your mc movieclip??

icicle
February 25th, 2003, 07:37 AM
100 frames in my loaded MC :-))))

i'll try your hint.. and after reply

i'm wrong... eh eh

icicle
February 25th, 2003, 07:44 AM
nothing happen!!!

i don't understand.. i can't control it!!!!

nothing to sugger?

bye Icicle

Dravos
February 25th, 2003, 07:45 AM
if i is only going to be 1-100 then that wont work properly
is i the percentage of load???

if your file is in flash 5 post it up and ill take a look

icicle
February 25th, 2003, 08:07 AM
not properly.. "i" is a counter that should take the player at certain frame (frames 1-100 of loaded mc) of "mc".
-----------------------------------------
vaia=((bytes_total/100)*i)
if (bytes_loaded <= vaia) {
_root.mc.gotoAndStop(i);
}
----------------------------------------
"vaia" define the 1%, 2% etc limit, step by step, and the condition (if) put forward the time line of loaded mc (with the index "i").

my code:

bytes_total = Math.round(getBytesTotal());
bytes_loaded = Math.round(getBytesLoaded());
i++;

getPercent = bytes_loaded/bytes_total;
varloadtxt = Math.round(getPercent*100)+"%";
vaia = ((bytes_total/100)*i);
if (bytes_loaded<=vaia) {
nextFrame();
if (bytes_loaded == bytes_total) {
gotoAndPlay("Scena 1", 1);
}
}

----------------------------------------


i think should be a comunication problem with "mc".
my fla is for FMX.

Dravos
February 25th, 2003, 08:24 AM
why not use the percentage u already have from

getPercent = bytes_loaded/bytes_total;
and round it.??



flag = 100-i;
bytes_loaded = Math.round(getBytesLoaded());
bytes_total = Math.round(getBytesTotal());
getPercent = bytes_loaded/bytes_total;
varloadtxt = Math.round(getPercent*100)+"%";
i=Math.round(getPercent);
_root.mc.gotoAndStop(i);
if (bytes_loaded == bytes_total) {
gotoAndPlay("Scena 1", 1);
unLoadMovie("mc")
}

icicle
February 25th, 2003, 08:37 AM
your code is cool!!!!!!!!!1

but the problem still remain.. the loaded mc ("mc") remain always at the first frame .. i don't know, really i don't know.

it ignore the line:

_root.mc.gotoAndStop(i);

i think.

dammation .:.:.:.:.

Dravos
February 25th, 2003, 08:54 AM
i notice when you create the mc you dont position it anywhere.

If you havent then you need to set its ._x and ._y

If this doesnt work try and go to the save option and check to see if you can save it to flash 5 as i have been told there should be the option to. then post your 2 flash 5 flas here