Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

flash 5 v mx

Status
Not open for further replies.

law78

Technical User
Apr 23, 2004
78
GB
Hi people,

I have been developing some actionscript for a few days now and I wanted to publish to the flash 5 player, I notice that my movie does not work under flash 5 and wanted to know if anyone knew why:

Here is the code I have been using:

Code on the main timeline:

Code:
_global.digit = 0;

Code attached to the buttons:

Code:
on(release){
	_global.digit = 1;
	loadMovieNum("illo.swf",1);
}

Code attached to illo.swf

Code:
empty_mc.attachMovie("illo"+_global.digit+"_mc", 1, 10);
if(_global.digit==3){
	next_btn._visible=false;
}
if(_global.digit==1){
	back_btn._visible=false;
}

Code attached to illo buttons

Code:
on (release) {
	if (_global.digit<3) {
		_global.digit = digit+1;
		empty_mc.attachMovie("illo"+_global.digit+"_mc", 1, 10);
	} else {
		_global.digit = 1;
		empty_mc.attachMovie("illo"+_global.digit+"_mc", 1, 10);
	}
}

Was really pleased to get it working as I only have basic A.S. skils but I really need it to export to flash 5, any help would be appreciated... thanks
 
_global only works from Flash player 6...

Maybe try _level0.digit... instead.
 
Will try that, not sure I will be able to reference from other external timelines like you can with _global.

I have a new problem now though, probably should post it in a new thread:

I have sepearate movie clips in the library that have an identifier name so that I can reference them, does this mean however that these movie clips cannot be loaded on the fly, the reason I ask is because I will eventually have 50+ hi-res images that I will need to reference from the library, but I think that flash is currently loading all these movies at once rather than when used (like when loading external swf files)?

Is this just a trade of with loading mc's using actionscript rather than putting them on the stage?

Thanks...
 
If the images are in the library of the flash movie they will get loaded when the movie loads. So you will have to wait for all 50+ high res images to load if they are all in the library.

You can however load images from external sources on the fly using loadMovie, loadMovieNum, or by setting the contentPath of a scrollpane to the url of your image.

To make application. Remove the images from the library and place your sequentially named images in a folder within the same folder as your flash file. Then use loadMovieNum to load them.

Example:
Code:
//if name of file is illo1.jpg
on (release) {
    if (_global.digit<3) {
        _global.digit = digit+1;
        loadMovieNum("illo"+_global.digit+".jpg", 2,"POST");
    } else {
        _global.digit = 1;
        unLoadMovieNum(2);
    }
}

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
I have decided to export as flash 6 :/

I wanted to preload the images, is this possible when loading jpg files?

Thanks
 
HeHe... oops forgot to replace the _global with _level0. Thanks Old. My Flash 5 is rusty.

Wow JT that almost looked like you knew what you were doing!
 
It's also worth pointing out that you're committing '_global' overkill: once the variable is defined once then you no longer have to use '_global' in front of it. In fact everytime you do use the declaration you're actually creating a new global variable of the same name which can lead to some confusion if you're building a large actionScript-heavy site.
 
I am using _global in front of everything because the variable is located on another timeline.

Is this how I should be referencing it, it works ok >>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top