Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,900 courses, including more Web and personalized recommendations.Start Your Free Trial Now
- View Offline
- Using Auto-Recovery and Auto-Save
- Working with the new Library Conflict Resolution dialog
- IK Pinning
- Copying and pasting layers in the Timeline
- Exporting and converting to the bitmap format
- Understanding incremental compilation
- Using new ActionScript code snippets
- Loading assets with the new ProLoader class
- Using the new features in the AIR for iOS and Android SDKs
Skill Level Intermediate
The Loader class can be used to load external SWF files. But problems can occur when you use it to load a SWF that contains TLF text fields. To overcome this, Flash now has the ProLoader class. The great thing about the ProLoader class is that it's added to the Code Snippets panel. So you can see how it works without having to look it up in the documentation. I'll open the Code Snippets panel and then find the Load and Unload actions and expand that folder.
I can double-click the Click to Load/Unload SWF, or Image action. So I double-click that and it says, This action requires an object to be selected on Stage. So I select the movie clip of the kid on the stage and I'll go back to the Code Snippets panel and double-click, Click to Load/Unload SWF, or Image. And here's the code, so let's take a look at it. So you note that it's pretty much the same as using a Loader class except for its called ProLoader.
You can look at the differences in Flash documentation, but if you look inside of this function, you'll see that you simply create a new instance of the ProLoader class. You call its Load Method, and add it to the stage. I'll change the URLRequest to an actual file on my computer which is called TLF.swf, and that's really it. So I'll test the movie and click on the kid. We'll see the SWF file load; it has TLF text with no problem at all.
So remember, if you're loading SWF files that contain TLF text fields, you can use the ProLoader class to get the best performance. And if you don't want to write out the code by hand, you can simply add the code snippet and Flash will write all of the code for you.