# newsFlasher component / utf-8 problem

**URL:** <https://forum.kirupa.com/t/newsflasher-component-utf-8-problem/34730>\
**Category:** flash\
**Created:** [November 5, 2003, 8:35pm UTC](https://forum.kirupa.com/t/newsflasher-component-utf-8-problem/34730 "2003-11-05T20:35:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mars](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mars](https://forum.kirupa.com/u/mars)\
**Post date:** [November 5, 2003, 8:35pm UTC](https://forum.kirupa.com/t/newsflasher-component-utf-8-problem/34730/1 "2003-11-05T20:35:32Z")

</div>

Hi

Here on kirupa I found a newsFlasher component tutorial ([http://www.kirupa.com/developer/mx/newsflasher.htm](http://www.kirupa.com/developer/mx/newsflasher.htm) ) and the component works quit well … BUT I need to import the external text as unicoded (UTF-8) because of some special danish characters (æ, ø, å) and I cant make the component “translate” the unicoded text.

I hope I make my self clear ?!

Can anyone help me. please??

Greetings from Lars, Copenhagen, [www.westend.dk](http://www.westend.dk)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 5, 2003, 8:39pm UTC](https://forum.kirupa.com/t/newsflasher-component-utf-8-problem/34730/2 "2003-11-05T20:39:56Z")

</div>

1. Make sure you save the text file as UTF-8 format, that can be easily done in Notepad.
2. Make sure you select a font which supports unicode for your dynamic text area. Arial, Times, Courier New are standard ones.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 5, 2003, 9:31pm UTC](https://forum.kirupa.com/t/newsflasher-component-utf-8-problem/34730/3 "2003-11-05T21:31:15Z")

</div>

Hi Phat7

The font (Verdana) supports unicode and the text is generated af UTF-8 by a PHP-script ( utf8\_decode($string); )

Is it possible that the AS makes it impossible ??

Here is the LONG code:  
/\* Headlab NewsFlasher V1.1 (updated 6/12/2002)  
Author: Mario “Klark Kent” Laugell  
contact: [kent@klarkkent.de](mailto:kent@klarkkent.de)  
URL/Business: [http://www.headlab.de](http://www.headlab.de)  
URL/Private: [http://www.klarkkent.de](http://www.klarkkent.de)  
_/  
// -----------------------------------------------------  
 #initclip  
// initialize the NewsTickerClass-----------\>  
NewsTickerClass = function () {  
this.init();  
};  
// register the Object-Class with the Movieclip-------------\>  
Object.registerClass(“hlnewsticker”, NewsTickerClass);  
// define INITialisation-function-------------------\>  
NewsTickerClass.prototype.init = function() {  
// get rid of the cross that helped positioning —\>  
this.crossMC.\_visible = false;  
// setting up a counter ----------------------------------\>  
this.count = 0;  
// dynamic Textfield-Properties ------------------------\>  
this.myTextTarget = this.\_parent[this.\_targetInstanceName];  
this.outerxPos1 = (this.aniRangeX/2)+(this.myTextTarget.\_x+this.myTextTarget.\_width);  
this.outerxPos2 = (this.aniRangeX/2)-(this.myTextTarget.\_x+this.myTextTarget.\_width);  
this.outeryPos1 = (this.aniRangeY/2)+(this.myTextTarget.\_y+this.myTextTarget.\_height);  
this.outeryPos2 = (-this.aniRangeY/2)-(this.myTextTarget.\_y-this.myTextTarget.\_height);  
this.centerYpos = this.myTextTarget.\_y;  
this.centerXpos = this.myTextTarget.\_x;  
this.animType = 0;  
//check the types of animation for the ‘ifs’ in the function theMoveOut --\>  
if (this.xAnim == true) {  
this.animType += 1;  
}  
if (this.yAnim == true) {  
this.animType += 2;  
}  
// Animation-Properties --------------------------------\>  
this.brakespeed = 5;  
this.myTime = 0;  
this.beginLoad();  
};  
// function to load the textfile and check if loaded -----\>  
NewsTickerClass.prototype.beginLoad = function() {  
loadVariables(this.targetFile, this);  
this.onData = function() {  
if (this.content != “”) {  
this.splitArray();  
delete this.onData;  
}  
};  
};  
// function to split the Textfile into an Array -----\>  
NewsTickerClass.prototype.splitArray = function() {  
//create an array that will hold the single texlines.----\>  
this.myArray = new Array();  
//splits the text sepparated by “,” --\>  
this.myArray = this.content.split(“XXX”);// |  
this.setTextfield();  
};  
// function to set the Textfield and -----\>  
NewsTickerClass.prototype.setTextfield = function() {  
if (this.myTextTarget.html == true){  
this.myTextTarget.htmlText = this.myArray[this.count];  
}else{  
this.myTextTarget.text = this.myArray[this.count];  
}  
if (this.yAnim == true) {  
this.myTextTarget.\_y = this.outeryPos1;  
}  
if (this.xAnim == true) {  
this.myTextTarget.\_x = this.outerxPos1;  
}  
// reset accelspeed --\>  
this.accelspeed = 0;  
this.theMoveIn();  
};  
// function for the Move-In Animation -----\>  
NewsTickerClass.prototype.theMoveIn = function() {  
this.onEnterFrame = function() {  
if (this.yAnim == true && this.centerYpos\<this.myTextTarget.\_y) {  
this.myTextTarget.\_y += ((this.centerYpos-this.myTextTarget.\_y)/this.brakespeed)/this.brake;  
}  
if (this.xAnim == true && this.centerXpos\<this.myTextTarget.\_x) {  
this.myTextTarget.\_x += ((this.centerXpos-this.myTextTarget.\_x)/this.brakespeed)/this.brake;  
updateAfterEvent();  
}  
if (this.centerYpos\>=this.myTextTarget.\_y-0.5 && this.centerXpos\>=this.myTextTarget.\_x-0.5) {  
delete this.onEnterFrame;  
this.theStopInterval();  
}  
};  
};  
// function that lets the Text stand still for the amount of Time in seconds,  
// that a user defined in “stopTime” -----\>  
NewsTickerClass.prototype.theStopInterval = function() {  
delete this.onEnterFrame;  
this.intervalHandle = setInterval(this, “onInterval”, 1000_this.stopTime);  
};  
NewsTickerClass.prototype.onInterval = function() {  
clearInterval(this.intervalHandle);  
this.theMoveOut();  
};  
// function for the Move-Out Animation -----\>  
NewsTickerClass.prototype.theMoveOut = function() {  
this.onEnterFrame = function() {  
this.accelspeed += this.acceleration;  
if (this.xAnim == true) {  
this.myTextTarget.\_x -= this.accelspeed;  
}  
if (this.yAnim == true) {  
this.myTextTarget.\_y -= this.accelspeed;  
}  
switch (this.animType) {  
case 1 :  
if (this.outerxPos2\>this.myTextTarget.\_x) {  
this.count++;  
if (this.count\>=this.myArray.length) {  
this.count = 0;  
}  
delete this.onEnterFrame;  
// call the setTextfield function again  
// this is where the whole thing starts looping  
this.setTextfield();  
}  
break;  
case 2 :  
if (this.outeryPos2\>this.myTextTarget.\_y) {  
this.count++;  
if (this.count\>=this.myArray.length) {  
this.count = 0;  
}  
delete this.onEnterFrame;  
// call the setTextfield function again  
// this is where the whole thing starts looping  
this.setTextfield();  
}  
break;  
case 3 :  
if (this.outeryPos2\>this.myTextTarget.\_y && this.outerxPos2\>this.myTextTarget.\_x) {  
this.count++;  
if (this.count\>=this.myArray.length) {  
this.count = 0;  
}  
// call the setTextfield function again  
// this is where the whole thing starts looping  
delete this.onEnterFrame;  
this.setTextfield();  
}  
break;  
}  
};  
};  
#endinitclip
