PDA

View Full Version : [mx] pls help correct this code..



Lacuna
February 19th, 2003, 07:23 PM
I'm attempting to create a clickable source from a movie clip
so that when the user clicks on the movie clip another movie clip (specifically 'profilecover.swf') loads in a separate area of the screen. I've used the following code... can someone let me know what factors should be changed so I can do the above..

________________ code:

onClipEvent (load) {
this.createEmptyMovieClip("pcover",1);
pcover.loadMovie("profilecover.swf");
this.onEnterFrame=function(){
var l=pcover.getBytesLoaded();
var t=pcover.getBytesTotal();
if (l > 0 && l >=t){
pcover._x=170;
pcover._y=30;
}
}

______________________ end code.

:love:
~ S. Blaze

pom
February 19th, 2003, 07:38 PM
And what seems to be the problem? :tie:

Lacuna
February 19th, 2003, 08:57 PM
i get the following:

__________________________________
Scene=Scene 1, Layer=profile, Frame=53: Line 11: Clip events are permitted only for movie clip instances
onClipEvent (load) {

Scene=Scene 1, Layer=profile, Frame=53: Line 22: Syntax error.
____________


but i thought i was making it for an instance....[stumped]

:love:
~ S. Blaze

BullDog_Flash
February 19th, 2003, 09:10 PM
I dont get much of those types of errors..

but i think it means you need to Give an instance name to th MC

Lacuna
February 19th, 2003, 09:19 PM
how do i give an instance name to a mc that is being externally loaded with several layers of it's own.... sorry if it seems to be an easy question.

:love:
~ S.Blaze

BullDog_Flash
February 19th, 2003, 09:23 PM
Were did you put the External Loading code

Lacuna
February 19th, 2003, 09:26 PM
it's in the code on the first post...?? is that not correct?

Lacuna
February 19th, 2003, 09:27 PM
the actual mc i am loading is in the same folder as the main file.

kode
February 19th, 2003, 10:02 PM
Scene=Scene 1, Layer=profile, Frame=53: Line 11: Clip events are permitted only for movie clip instances
onClipEvent (load) {

Scene=Scene 1, Layer=profile, Frame=53: Line 22: Syntax error.
the code is supposed to be used in the movie clip actions and you're placing it in the timeline ... :)

if you want to use it from the timeline it should be something like this:

instance.createEmptyMovieClip("pcover", 1);
pcover.loadMovie("profilecover.swf");
instance.onEnterFrame = function() {
l = pcover.getBytesLoaded();
t = pcover.getBytesTotal();
if (l>0 && l>=t) {
pcover._x = 170;
pcover._y = 30;
}
}

kode
February 19th, 2003, 10:05 PM
or in the mc actions:

onClipEvent (load) {
this.createEmptyMovieClip("pcover", 1);
pcover.loadMovie("profilecover.swf");
this.onEnterFrame = function() {
l = pcover.getBytesLoaded();
t = pcover.getBytesTotal();
if (l>0 && l>=t) {
pcover._x = 170;
pcover._y = 30;
}
}
}

Lacuna
February 19th, 2003, 10:27 PM
ahhhhhh...... none of this stuff is working!! let me try to explain because I must be leaving something out.

I have a movie clip - lets call it mc1 - (it can't be a button because of it's nature) that loads upon entering the keyframe.

Now I want mc1 to load ANOTHER movie clip - lets say mc2 - farther down the screen when someone clicks on mc1.

The PROBLEM arises because the mc1 loads on a blank keyframe which i therefore can't change into a symbol and mc2 can't contain the button properties because they need to click on the mc1 to make it work.

Am I just not understanding the above help or did i not properly explain myself originally? PLease PleAse help me out guys...i am at a total lost with this.

:love:
~ S. Blaze

kode
February 19th, 2003, 10:43 PM
oops .. sorry

i didn't pay attention to your first post :-\

mc1.onRelease = function () {
createEmptyMovieClip ("holder", 1)
holder.loadMovie ("somefile.swf")
this.onEnterFrame = function () {
if (holder.getBytesLoaded() == holder.getBytesTotal()) {
holder._x = 170
holder._y = 30
}
}
}

Lacuna
February 19th, 2003, 10:52 PM
so since mc1 cant have an instance name because it has to load on a blank keyframe...what do i do then....i am really really sorry that i am making this hard. I've also tried to create a button underneath the externally loaded mc1 but even when i increase the layer # on the button it stays underneath mc1.. am i making any sense at all? I think this might just all sound like babble.

:love: ~ S. Blaze ~ :love:

kode
February 19th, 2003, 11:02 PM
you're right .. we're making this too hard


so since mc1 cant have an instance name because it has to load on a blank keyframe
the instance name will remain in every single frame of the whole movie


ok ..

you have a movie .. in x frame of the movie you load another movie containing mc1 ?? then you load another movie when mc1 is pressed ?? :: confused ::

can you attach your files ? :)

Lacuna
February 19th, 2003, 11:05 PM
1 sec and i'll upload them

kode
February 19th, 2003, 11:08 PM
:: takes a beer and waits :: :P

Lacuna
February 19th, 2003, 11:30 PM
~~whew...here we go..

check it out @ http://www.cyberwebs.org/test/practice.swf

..i need this (which is an external mc) to be clickable and able to load mc2 which has about 6 or 7 of it's own layers when you open it up as a separate file to edit.

:love:

And thanks a lot for all your patience and help Kax. I'll owe you big for this one!

:love: :love: :love: S.Blaze

__________________________________

Also some other locations:

http://www.cyberwebs.org/test/practice.swf
http://www.cyberwebs.org/test/practice.fla
http://www.cyberwebs.org/test/practice.html

http://www.cyberwebs.org/test/rgprofile.swf
http://www.cyberwebs.org/test/rgprofile.fla
http://www.cyberwebs.org/test/rgprofile.html

http://www.cyberwebs.org/test/boxopener.swf
http://www.cyberwebs.org/test/boxopener.fla
http://www.cyberwebs.org/test/boxopener.html

kode
February 19th, 2003, 11:47 PM
do you have a mac ?? i can't open your files :-\

if you do .. zip your files. usually it solves the problem =)

Lacuna
February 20th, 2003, 12:08 AM
FINALLY...........

Thanks for the continued help. Here's the zip.

Zip File (http://www.cyberwebs.org/test/rgprofile.zip)

:love: ~S. Blaze

Lacuna
February 20th, 2003, 12:36 AM
WHOOHOOO.... i was altering that last coding you gave me and came up with :

____________________

onMouseDown = function() {
createEmptyMovieClip ("holder", 8)
holder.loadMovie ("boxopener.swf")
this.onEnterFrame = function () {
if (holder.getBytesLoaded() == holder.getBytesTotal()) {
holder._x = 400
holder._y = 70
}
}
}

_____________

which works!! Oh YEA!! That's what we like to see. Now as the final touch (if possible) can I change the cursor look to an arrow or something so ppl can easily tell they are suppose to click on the wording??

P.s. Kax ... you are amazing and you can't believe how grateful i am for all of your help!!

:love: ~ S.Blaze

kode
February 20th, 2003, 12:54 AM
P.s. Kax ... you are amazing and you can't believe how grateful i am for all of your help!!
what ? i didn't do anything !! :stunned:
but .. you're welcome ;)

:P


going back to the point of this thread ..

there's no reason to wait until the new movie is fully loaded to move the mc .. so i'd use something like:

onMouseDown = function() {
createEmptyMovieClip ("holder", 8)
holder.loadMovie ("boxopener.swf")
holder._x = 400
holder._y = 70
}
besides it would save resources :)

and regarding the use of the hand cursor ..

instance.useHandCursor = true

Lacuna
February 20th, 2003, 09:09 AM
oh you helped plenty. i couldn't have figured it out without you. thanks for cursor info as well. hopefully i can help you out one day.

:love:
~ S.Blaze