[mx] pls help correct this code

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

And what seems to be the problem? :tie:

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

I dont get much of those types of errors…

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

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

Were did you put the External Loading code

it’s in the code on the first post…?? is that not correct?

the actual mc i am loading is in the same folder as the main file.

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 … :slight_smile:

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;
	}
}

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;
		}
	}
}

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

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
		}
	}
}

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:

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 ?? [size=1]:: confused ::[/size]

can you attach your files ? :slight_smile:

1 sec and i’ll upload them

[size=1]:: takes a beer and waits ::[/size] :stuck_out_tongue:

~~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

do you have a mac ?? i can’t open your files :-\

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

FINALLY…

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

Zip File

:love: ~S. Blaze

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