Hello !:)
I try to build a simple news reader which can display HTML text contained in XML file.
I don't have any problem to preload XML file but I noticed that images contained in the HTML text aren't loaded in the first frame... So, as I don't know how many images have to be loaded, I don't know when I can get the final height of my textField to build the scroller...(which is the central point of my problem!) Peter Ent: Scrolling Text Component:: Peter: You could modify the code to use the htmlText property and . ()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\preloaders\Preloader.as:398] http://weblogs.macromedia.com/pent/archives/2007/12/scrolling_text.htmlHOME |
Does someone have an idea ?
Is it possible to preload the entire HTML text (I mean text and tags like ) before placing it in the textField ?
Or is it possible to add a kind of loader to this HTML text which will indicate when the text is fully loaded ?
Thanks a lot.
For those who can be interested :
var totBytes:Number = 0;
//put images in an Array
var myImg:Array = new Array();
for(var mc in myTextField){
if(typeof(myTextField[mc]) == "movieclip"){
myImg.push(myTextField[mc]);
} Flash 8 ActionScript 2.0 Video Training Course | KeyStone Learning :: 9.2 Project – Create a Preloader Bar Clip (Flash MX Style) Without 18.1 Dynamic HTML Text with LoadVars OnLoad( ); 18.2 Dynamic HTML Text with http://www.keystonelearning.com/courses/flash_8_actionscript_2_training_course/HOME | FlashComponents: Circular Glow Preloader, dropMenu, XML Driven :: Circular preloader animation with glow effect. The dropMenu component provides an easy way t. Simple code No instance of btn MovieClip. http://www.softplatz.com/Info/FlashComponents.htmlHOME |
}
//images preload
this.onEnterFrame = function(){
var bl:Number = 0;
var tb:Number = 0;
for(var img in myImg){
bl += myImg[img].getBytesLoaded();
tb += myImg[img].getBytesTotal();
}
if(bl/tb >= 1 && !isNaN(bl/tb)){
delete this.onEnterFrame;
makeScroll(myTextField);
}
}
This work fine to preload images which are in html textField rendered from XML file... in order to build a smooth scrollable html textField for example...
Thanks MureJIb;)
When Image is included into html-textField it is "rendered" as usual MovieClip.
YOu can even include mc from the library using IMG tag.
So you can "scan" textfield for MovieClips.
for (var mc in test_txt) {
if (typeof(test_txt[mc]) == "movieclip") {
trace ("found IMG: "+test_txt[mc]);
// if no ID was set - MC will be called instanceN
}
}
And when typeof(test_txt[mc]) is true - you can add test_txt[mc] to some Array - and then manipulate this mc as other MovieClips
thanks for your quick answer !
I try this now...
Great !!!
I didn't know that.
Thanks, this will help me a lot.
nicolb, glad to see it helped ))
Funny, but today morning I understood that I needed this too )))
Right now I was about to design some code for preloading img-s )))
And here it is )) ready for use )
This work fine, but as I don't know how many images there are in my HTML text it's a little difficult to use images ID. I think a workaround is possible using the for() or while() statement and IDs like "img1,img2...", and testing if the image exists or not.
But do you know if it's possible to obtain the images collection from the HTML text using tags and not IDs ?
Thanks.
For this test you will need test.jpg in the same directory and two textFields on the stage - 'test_txt' with html render ON and prel_txt - to indicate preloader.
var str:String="Testing the image preloader
 "
test_txt.htmlText = str;
onEnterFrame = function ():Void {
var proc = test_txt.img.getBytesLoaded()/test_txt.img.getBytesTotal()*100;
prel_txt.text = Math.round(proc);
}
The main part of the solution is giving an ID attribute in the IMG tag
Where's The Advantage In Windows Genuine Advantage?
Stocks Bounce After S&P Joins Bear Market |