Today is the day the preloading will work! Help...
I've tried and tried to find different ways to make the preloading work correctly but there is always something that doesn't seem to work with each way. Could someone dumb it down for me and help me understand how to make this work. I've read everything on the safeloader and at this link:
http://www.stevensacks.net/2010/05/28/flash-cs5-tlf-engine-causes-errors-with-loaded-swfs/
I've also browsed all blogs and adobe tech notes and just had no luck getting a way that always worked. Here is what I'd like to do:
Create a preloader swf that contained a movie clip to display the percent.
Allow the preloader swf to call functions inside of the loaded swf. (this is for stage resizing, usually)
Be able to use the tlf textengine in my loaded swf's.
Keep my reference to the stage or pass it from the preloader swf to the loaded swf.
Every way I've tried seems to lose at least one of these items. Right now I have a file that uses the tlf textfield and a stage reference. It works fine as a standalone swf but it needs a preloader. In the as 3 settings the tlf is merged into the code. The extra size isn't that big of a deal, for now. However, I would love to not do that and point the preloader away from adobe's stock preloader to my own in the as 3 settings. However, I can never get it to work correctly.
Can anyone point me in the right direction? Thanks!
Kglad, I created a system
that works. I will post it here so others can use it if needed.
Outline: I'm using a custom preloader.swf to load another swf file. The loaded swf file contains a document class and the tlf textfield. I am able to load this correctly, track the percent loaded, pass the stage reference, use the tlf textfield and use the stage resize functions to dispatch listeners for sites that are 100% of the browser.
THE PRELOADER SWF
This file simply contains the preloader movieclip in the library and code in frame 1. I guess a doc class would work here but I have not tested. The AS 3.0 settting are the default settings for player 10.
Code:
//======================================================================================== =================================================
// import classes
//======================================================================================== =================================================
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.filters.BevelFilter;
import flash.display.MovieClip;
import flash.display.Loader;
//======================================================================================== =================================================
// set stage alignment
//======================================================================================== =================================================
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.ACTIVATE, activateHandler);
stage.addEventListener(Event.RESIZE, resizeHandler);
//======================================================================================== =================================================
// variables
//======================================================================================== =================================================
var pre_loader:Preloader;
var this_page:String = "sbBackground.swf";
var load_bar_width:Number = 150; // make this the width of your image
//======================================================================================== =================================================
// variables
//======================================================================================== =================================================
function activateHandler(event:Event):void {
trace("here");
//======================================================================================== =================================================
// variables
//======================================================================================== =================================================
function resizeHandler(event:Event):void {
trace("resizeHandler: " + event);
trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);
//======================================================================================== =================================================
// variables
//======================================================================================== =================================================
var background_ldr:Loader;
var background_mc:MovieClip;
var background_holder:MovieClip = new MovieClip();
addChild(background_holder);
//======================================================================================== =================================================
// init site
//======================================================================================== =================================================
function init():void{
// show preloader
pre_loader = new Preloader();
addChild(pre_loader);
pre_loader.x = Math.round(stage.stageWidth/2) - Math.round(pre_loader.width/2);
pre_loader.y = Math.round(stage.stageHeight/2) - Math.round(pre_loader.height/2);
pre_loader.load_bar.width = 1;
// load page
loadThisPage(this_page);
//======================================================================================== =================================================
// load called page
//======================================================================================== =================================================
function loadThisPage(thisPage:String):void{
// load new page
background_ldr = new Loader();
var pageRequest:URLRequest = new URLRequest(thisPage);
background_ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, pageCompleteHandler);
background_ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, pageProgressHandler);
background_ldr.load(pageRequest);
function pageCompleteHandler(loadEvent:Event){
background_mc = MovieClip(background_ldr.content);
background_holder.addChild(background_mc);
removeChild(pre_loader);
function pageProgressHandler(e:ProgressEvent){
var loaded:Number = e.target.bytesLoaded;
var total:Number = e.target.bytesTotal;
var pct:Number = loaded / total;
trace(pct);
pre_loader.pct_txt.text = String(Math.round(pct * 100)) + "%";
pre_loader.load_bar.width = Math.round(pct * load_bar_width);
THE LOADED SWF
This file also used the default settings for Flash player 10. Therefore, I am not merging into the code my tlf library so no increase in file size.
The doc class:
package com {
// core
import flash.display.MovieClip;
import flash.display.Stage;
import fl.text.TLFTextField;
import flash.events.Event;
// import custom classes
import com.main.BuildStageClass;
// initialize class
public class DocClass extends MovieClip {
// custom classes
// variables
public static var build_stage_class:BuildStageClass;
// stage containers
public static var main_stage:MovieClip;
// private toggle var
private var init:Boolean = false;
// main constructor
public function DocClass() {
addEventListener(Event.ADDED_TO_STAGE, stageAddedHandler);
private function stageAddedHandler(e:Event){
// trace("Document Class Stage: " + this.stage);
// initialize classes
build_stage_class = new BuildStageClass();
// wait until second added to stage call to initialize application
if(init == false){
init = true;
else{
removeEventListener(Event.ADDED_TO_STAGE, stageAddedHandler);
// add containers to stage
main_stage = new MovieClip();
addChild(main_stage);
// start app
startApplication();
public function startApplication():void{
//trace("here at start");
// build stage
build_stage_class.buildStage();
This works 100% for me without using the safeloader in the preloader.swf. I've experienced some issues with the safeloader before so not using it is a blessing.
I hope this helps someone! Enjoy.
Similar Messages
-
I cannot open Adobe photoshop CS2 which I was using 10 days ago. Can I restore the system to before 10 days, so it will work again?
The hatter wrote:
Rosetta can have a 2GB RAM "tax" to manage PowerPC code as well as how that affects performance.
I think real world performance shows both statements to be wrong; consider this:
If that were the case, how come Apple does not include that information in its Snow Leopard installation requirements, since Rosetta is an optional install?
Also, running a PowerPC app on an 2011 i7 Mac with Snow Leopard will run faster than running that PowerPC app on a PowerPC Mac. -
i bought an factory unlocked iphone 3gs at the apple store today and just ordered a sim card activation kit and a 30 dollar minute card for it. the sim will work in the unlocked iphone am i correct? and i can use messaging on it right?
If T-Mobile in the US, while your phone will activate/work, you won't have FaceTime, MMS or 3G. T-Mobile, in the US, is not a supported iPhone carrier, thus all features of the iPhone may not be available. T-Mobile's 3G network, in the US, is not compatible with the iPhone.
-
I installed mavericks today and the mail will not open and just keeps on not responding how do I get it back I have force quit it a number of times now
Open the system menu via Alt+Space or click the Firefox icon on the title bar and see if you can resize that window.
If that works then close Firefox to save that setting.
See also http://kb.mozillazine.org/Resizing_oversize_window
Window sizes and positions are stored in [http://kb.mozillazine.org/localstore.rdf localstore.rdf] in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder].
See http://kb.mozillazine.org/Corrupt_localstore.rdf -
Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?
Remove the extensions, redownload Safari, reload the extensions.
http://www.apple.com/safari/download/
And if you really want a better experience, use Firefox, tons more choices and possibilities there.
Firefox's "NoScript" will block the Trojan going around on websites. Best web security you can get.
https://addons.mozilla.org/en-US/firefox/addon/noscript/
Ghostery, Ad Block Plus and thousands of add-ons more have originated on Firefox. -
i bought an IPAD air (32 gb wifi only) from USA just one month ago and the screen is not working correctly(picture attached) and right now i'm in Egypt ,can i send my ipad to service in Egypt and the warranty will work in Egypt or what?
Have you tried a soft-reset to see if that fixes it ? You might be able to get warranty service in Egypt for your iPad, but the warranty includes :
IMPORTANT RESTRICTION FOR iPHONE AND iPAD SERVICE.
Apple may restrict warranty service for iPhone and iPad to the country where Apple or its Authorized Distributors originally sold the device.
As it's wifi-only you should have a better chance of it being serviced under warranty, but there are no guarantees, it might depend upon the repairer.
Egypt authorised service providers : https://locate.apple.com/eg/en/ -
I was given an iMac without iPhoto. Have updated to OS to 10.6.8. How do I get a version of iPhoto that will the updates will work with? Downloaded 9.2.1 and it looked for 9.1; downloaded 9.1 and it looked for 9.0??
You can Purchase iPhoto in the Apps Store...
-
The description says it all. I bought a movie on iTunes but when I try to watch it plays back slowly with no sound. Then the video will speed up and the sound will work for a moment then off again and back to slow motion. I have a dell laptop running windows 7
Hi Normanwh,
If you are having video playback issues in iTunes on your Windows machine, you may find the following article helpful:
Apple Support: Troubleshooting iTunes for Windows Vista or Windows 7 video playback performance issues
http://support.apple.com/kb/ts1718
Regards,
- Brenden -
My PowerBook G4 says that it's connected to wifi, but it still no internet connection. The connection will work for a while, and then I'll have to run diagnostics and it will work again for a few minutes and then stop working again. What's going on??
Basic troubleshooting techniques for any problem
Restart the computer = joy?
Reset the router = joy?
Restart the computer in Safe Mode = joy?
ask yourself "What changed immediately preceding the onset of the problem?" = Anything... hardware, software, cabling, environment (interference source)
ÇÇÇ -
I have lost the remote that was paired. I bought another remote, but the procedure to pair the new one does not work. I suspect the the AT will work with only one remote at-a-time and i have to unpair the first before pairing the second. If this is true, how do I unpair? If not, what can I do?
I was premature in posting the question. I found the answer in andother posting, and it was successful.
Thanks, and sorry for the false alarm. -
HT1588 when i play a movie in itunes the audio will work for a little bit then stop
when i play a movie in itunes the audio will work for a little bit then stop
Hi there,
I would recommend taking a look at the troubleshooting steps found in the article below.
Troubleshooting iTunes for Windows Vista or Windows 7 video playback performance issues
http://support.apple.com/kb/TS1718
-Griff W. -
after update.. i can not start the ipad, when i press agree in the terms ...it will freeze and the screen not working///help please
What to Do When Your iPad Won't Turn On
http://ipad.about.com/od/iPad_Troubleshooting/ss/What-To-Do-When-Your-Ipad-Wo-No t-Turn-On.htm
iOS: Not responding or does not turn on
http://support.apple.com/kb/TS3281
iPad Frozen? How to Force Quit an App, Reset or Restart Your iPad
http://ipadacademy.com/2010/11/ipad-frozen-how-to-force-quit-an-app-reset-or-res tart-your-ipad
iPad: Basic troubleshooting
http://support.apple.com/kb/TS3274
iOS: Resolving update and restore alert messages
http://support.apple.com/kb/TS1275
iPad: Unable to update or restore
http://support.apple.com/kb/ht4097
Cheers, Tom -
I will studying in the UK for the next year and want to know if an unlocked iPhone 4S with a new sim card purchased in the UK will work as opposed to getting a new phone? There seem to be differeing opinions on this.
Iphone 4s only has one version so it should work world wide in any carrier..As long as it's and unlocked version ofcourse.
-
today on the way to work it was raining heavily when i got to work my coat and pocket was soaked with my i phone 5 in it i took it out and wiped the screen off when i got to work and put it in my bag the likfe was on like 50% when i go on my break like 4 hours later my phone is dead and would not turn on for a while when it did it had some writting in the top left corner ive tried resseting my phone on i tunes and nothing has helped and the phone is relatively brand new so i need HELP?
Hi Tone96,
Based on your description, it sounds like you may need to have your iPhone serviced. You may find the following page helpful:
Service Answer Center - iPhone
http://support.apple.com/kb/index?page=servicefaq&geo=United_States&product=ipho ne
Regards,
- Brenden -
my ipod shuffle 4th gen bought today and the voice over works for naming playlist and battery percent but wont name song and artist can anyone help also is the voice over button meant to be soft when pushed ?
thanksThis document explains setting up and using VoiceOver.
http://support.apple.com/kb/ht4322
The overall settings for VoiceOver is on the shuffle's Summary screen in iTunes.
Artist name and song name - Press and release the VoiceOver button.
The playlist menu - Press and hold the VoiceOver button.
Maybe you are looking for
-
HT4993 iPhone 4s IOS 6.1.1 Calendar issue
I upgraded my iPhone 4s to iOS 6.1.1 two days, after the upgrade, my calendar is not working correctly. Any event which is not created by me could not be edited, As soon as I open the event, I get either to "decline", "MAyBe" or "Accept" option. Even
-
Passing Object parameters to Procedures in Oracle
Hi, Can any one please provide me with a sample example how to pass object types as parameters (IN) to a procedure/package. Thanks in Advance.
-
Nested Tables Repeat Header Row RTF Output Not Working v5.6.2(PDF does)
All, Has anyone used nested tables in heading rows where they are set to repeat nested table header row across page breaks for RTF output ? This seems to work for PDF generation (line breaking enforcement doesn't) but I don't even get RTF Header ROWS
-
I am seeing graphical redraw problems when I try screen sharing with another Mac 10.8 computer, Mac Mini mid 2011. For example, when switching menus, the old ones remain. This always worked just fine in Lion. I tried turning adaptive and scaling off
-
Which setting takes priority??
I have an user base of 500 users.I do not want to schedule the reports. All the users will open the reports and view the data. Since there are 500 users they do not want the users to hit the database 500 times. They want to make use of the Cache TIme