Add

QueueLoader 3.1.8 CSS Example


I had someone come to me with some issues using the CSS item in QueueLoader. We went back and forth and I had forgotten that QueueLoader parses the stylesheet from the loader data internally. OK great, but still couldn't get the text to style. I've actually had problems with textfields and css in general in the past. So I did a little troubleshooting and was able to get it working fine. Seems the issue was making sure you set the textfield's css property BEFORE adding any html text to it. This sort of seems obvious in hindsight, but it's not one of those immediately obvious things when your scanning over code and/or tracking the flow of your functions. So yeah, do that first :)

Here's some slightly updated CSS code:

// CSS Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
import com.hydrotik.queueloader.QueueLoaderConst;
 
var _oLoader:QueueLoader = new QueueLoader();
 
var tf:TextField = this.getChildByName("css_text") as TextField;
 
var css:StyleSheet;
 
_oLoader.addItem("../includes/admin/test.css", null, {title:"CSS"});
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.fileType == QueueLoaderConst.FILE_CSS) {
		trace("\t\tCSS: "+event.content.styleNames);
		css = event.content;
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
 
	// MAKE SURE YOU STYLE THE FIELD FIRST BEFORE SETTING THE HTML TEXT!!
	tf.styleSheet = css;
	tf.htmlText = "<p>This is a Test <a href='http://www.test.com'> More Text</a></p>";
}

This person also suggested that I provide detailed guides for people and a website to promote QL. There are plenty of examples within this blog as well as a place on github to keep track of QueueLoader and (hopefully) promote it. Github is also the most authoritative source on QueueLoader. It even has a logo! That said, his comments do bring up a couple of points. The first is that between the code snippets and the examples on the blog, as well as the examples.fla file in the slighty older zip file, it might be a bit confusing on how to get set up. If you download the older example files, you can then get the latest version of QL and overwrite it/update it by placing it in the proper package. The only thing that has changed significantly is the QueueLoaderConst file. If you are checking for specific item type, then you would need to change the class i.e. QueueLoader.FILE_CSS to QueueLoaderConst.FILE_CSS. This was done to improve performance. Also be sure to include the import to QueueLoaderConst.

Said person (I swear I'm not picking you:) also suggested that QL is geared towards more hard core actionscripters which isn't really the case. I know it's a jump getting into some external library based utilities, but I think (and hope) QL is set up to be almost as easy as using a core loader class and is easier to use then other options out there. I'm thinking the frustration comes from the disjointed hosting locations/examples and putting the information in the users hands. On the flip side however, there are plenty of recent links to github and I encourage you to check out the wiki as all the examples are there. Also do a search on the blog, there are a ton of posts on QL and many of the examples are still close enough to the current structure, they should get the idea across. If something is out of date on github let me know, or feel free to fork it!

Lastly, I know the documentation can be improved, the files could be retroactively updated, etc. But keep in mind that I don't get paid for this, I very rarely get a donation (I'm actually surprised when i do get one;), I've never gotten a job from QL, and for quite some time I have had no help with QL. I really, really enjoy working on QL and Flash in general and I'm certainly not complaining. Most importantly, I also would hate to discourage people from coming to me with issues or needing help. Just wanted to get this off my chest:)

No comments yet.

Respond

get in on the action.

* Required

  • Viagra ordre
  • Cialis en ligne
  • Levitra en ligne
  • Propecia acheter
  • Viagra acheter
  • Acheter cialis
  • Ordre levitra
  • Ordre propecia
  • En ligne viagra
  • Vente cialis
  • Levitra bon marche
  • Propecia en ligne
  • Viagra online
  • Buy cialis
  • Order Levitra
  • Buy propecia
  • Buy viagra
  • Cheap cialis
  • Cheap Levitra
  • propecia online
  • Viagra prescription
  • Cialis online
  • Buy Levitra
  • Order propecia