Charger un text dynamique en AS2

zrellianiss Messages postés 26 Date d'inscription lundi 30 mars 2009 Statut Membre Dernière intervention 5 juin 2010 - 18 avril 2009 à 10:16
zrellianiss Messages postés 26 Date d'inscription lundi 30 mars 2009 Statut Membre Dernière intervention 5 juin 2010 - 18 avril 2009 à 12:12
Bonjour
Comment charger un text dynamique dans flash en AS2 (le text charger est de format txt et il contient des caractères spéciaux (é à è....)

4 réponses

Orange73 Messages postés 1375 Date d'inscription dimanche 28 novembre 2004 Statut Membre Dernière intervention 2 août 2011
18 avril 2009 à 10:38
Hello,

Regarde du coté de loadVars();

-- Orange73 --
"L'homme n'est pas fait pour travailler, la preuve c'est que cela le fatigue" (Voltaire)
0
zrellianiss Messages postés 26 Date d'inscription lundi 30 mars 2009 Statut Membre Dernière intervention 5 juin 2010
18 avril 2009 à 11:13
salu
je veux vous expliqué un peut la situation et la démarche de mon travail:
voici les dernières resultats sur un chargement de text sur flash en AS2. bon voila le code:

var mytext2:TextField = this.createTextField("mytext2", this.getNextHighestDepth(), 190, 1, 204 , 500);
mytext2.multiline = true;
mytext2.wordWrap = true;
mytext2.border = false;
mytext2.html=true;
System.useCodepage=true;




myformat = new TextFormat();
myformat.color = 0x990000;
myformat.bullet = false;
myformat.size=11;
myformat.font="arial";






/********************************************************






  Chargement de la page html et traitement des données
 
*********************************************************/
//On crée une reference à _root (pour le ciblage)
var root:MovieClip = this;
//On crée une nouvelle variable de chargement
var lorem_lv:LoadVars = new LoadVars();
//lorsque "lorem" est invoqué
lorem_lv.onData = function(src:String):Void  {
 if (src != undefined) {
  //si le fichier html est chargé alors...
  mytext2.htmlText = src;
  mytext2.setTextFormat(myformat);
 } else {
  //et si le ficher html n'est pas trouvé
  mytext2.text = "Impossible de charger le fichier";
  mytext2.setTextFormat(myformat);
 }
};
//Url a charger
lorem_lv.load("about_content/about.txt");




la partie selectionné en rouge donne la position de text (x,y) la longueur et la hauteur
le problème ici est: je veux que le scrollbar s'adapte automatiquement à la largeur et à la position du champ de text et  la hauteur de text charger.



merci. j'attend votre réponse
0
Orange73 Messages postés 1375 Date d'inscription dimanche 28 novembre 2004 Statut Membre Dernière intervention 2 août 2011
18 avril 2009 à 11:36
Quelle scrollbar ?

-- Orange73 --
"L'homme n'est pas fait pour travailler, la preuve c'est que cela le fatigue" (Voltaire)
0
zrellianiss Messages postés 26 Date d'inscription lundi 30 mars 2009 Statut Membre Dernière intervention 5 juin 2010
18 avril 2009 à 12:12
je ne sais pas comment expliqué la situation mais je peux vous dire que le text charger est dans un scrollbar.
je veux vous décrir ma méthode de travaille avec les actions scriptes.
 1- insertion d'un symbole clip nommé: page d'accueil. la il ya 4 calques
       1- calque d'action scripte de fonctionnement de scrollbar:

//SCROLLBAR FUNCTIONS




//cover text with a mask to hide extended text
txt.setMask(mask);





//If text is higher than the mask, then show scrollbar
//else, if text is smaller, hide the scrollbar
this.onEnterFrame = function() {
 if (txt._height<=mask._height) {
  scrollbar.scrollbarBtn._visible = false;
  scrollbar.scrollbarBack._visible = false;
 } else {
  scrollbar.scrollbarBtn._visible = true;
  scrollbar.scrollbarBack._visible = true;
 }
};





//When user presses on the scrollbar
scrollbar.scrollbarBtn.onPress = function() {
 if (this.hitTest(_root._xmouse, _root._ymouse) && txt._height>mask._height) {
  //user is only able to drag on the scrollbar background
  this.startDrag(false,scrollbar.scrollbarBG._x,scrollbar.scrollbarBG._y,scrollbar.scrollbarBG._x,scrollbar.scrollbarBG._height-this._height);
  //Call scrollThumbs function for easing
  txt.onEnterFrame = scrollThumbs;
  dragging = true;
 }
};





//When the user releases the scrollbar
scrollbar.scrollbarBtn.onRelease = scrollbar.scrollbarBtn.onReleaseOutside=function () {
 stopDrag();
 dragging = false;
 scrollbar.scrollbarBtn.gotoAndPlay("out");
 delete this.onEnterFrame;
};
//on rollover
scrollbar.scrollbarBtn.onRollOver = function() {
 scrollbar.scrollbarBtn.gotoAndPlay("over");
};
//on rollout
scrollbar.scrollbarBtn.onRollOut = function() {
 scrollbar.scrollbarBtn.gotoAndPlay("out");
};





//text easing function
function scrollThumbs() {





 var funkyVar = -this._parent.scrollbar.scrollbarBtn._y*(((this._height-this._parent.scrollbar.scrollbarBtn._height)/(this._parent.scrollbar.scrollbarBG._height-this._parent.scrollbar.scrollbarBtn._height))-1);
 // change .2 for speed
 this.Y = (funkyVar-this._y)*.2;
 this._y += this.Y;
 if (Math.abs(funkyVar-this._y)<1 && !dragging) {
  delete this.onEnterFrame;
 }





}





//----------------MOUSE SCROLL LISTENER





//clearListener is called from the INDEX file when clicked on the
//"About Us" button. This removes the old Mouse listener so that
//the mouse listeners would not overlap.
function clearListener() {
 Mouse.removeListener(mouseListener);
}





var mouseListener:Object = new Object();





//When user uses the mouse wheel
mouseListener.onMouseWheel = function(delta) {
 //change the 3 for how much to scroll on single scroll
 scrollbar.scrollbarBtn._y -= delta*3;
 if (scrollbar.scrollbarBtn._y<0) {
  scrollbar.scrollbarBtn._y = 0;
 }
 if (scrollbar.scrollbarBtn._y+scrollbar.scrollbarBtn._height>mask._height) {
  scrollbar.scrollbarBtn._y = mask._height-scrollbar.scrollbarBtn._height;
 }
 //call ease text function
 txt.onEnterFrame = scrollThumbs;
};





// adding the listener to the Mouse object
Mouse.addListener(mouseListener);
 

calque 2: le symbole de scrollpane
calque 3: masque de scrollmask
calque 4: le continue textuelle son symbole et son action scripte déja envoyer

voilà j'espère que vous avez une idée claire sur le travail.
désolé pour le dérangement et merci infiniment à vous
0
Rejoignez-nous