IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ActionScript 1 & ActionScript 2 Discussion :

rafraichissement du cellrenderer [Fait]


Sujet :

ActionScript 1 & ActionScript 2

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2008
    Messages : 8
    Par défaut rafraichissement du cellrenderer
    j'ai un problème dans une application en flash8 actionscript2.0;
    j'ai une datagrid et j'ai mis un cellrenderer je me suis basée sur le htmlcellrenderer de philflash mon problème est le suivant : c'est que je voudrais rafraichir automatiquement la cellrenderer soit 1 seconde ou 5 secondes ou 30 secondes j'ai essayé par Enterframe function(){} et aussi par setInterval(), et ça marche pas ;

    merci de votre aide

  2. #2
    Rédacteur/Modérateur
    Avatar de beekeep
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Octobre 2006
    Messages
    2 005
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Octobre 2006
    Messages : 2 005
    Par défaut
    pour compter en seconde c'est plus pratique avec setInterval.

    mais qu'es-ce qui ne marche pas exactement ?
    on peut voir ton code ? as-tu regardé la doc ?

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2008
    Messages : 8
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    import mx.core.UIComponent;
    import mx.controls.TextArea;
    import TextField.StyleSheet;
     
    class HtmlCellRenderer extends UIComponent
    {
     
        static public var CssUrl:String;        // Global: URL for CSS stylesheet
        static public var style_sheet:StyleSheet = null;
     
        var htmlComponent:TextField;
     
         var owner; // The row that contains this cell    
        var listOwner : MovieClip;   // the reference we receive to the list
        var getCellIndex : Function; // the function we receive from the list
        var    getDataLabel : Function; // the function we receive from the list
     
        var previousLabel:String = null; // for optimization
     
        function HtmlCellRenderer()
        {
        }
     
        function createChildren(Void) : Void
        {
            if (CssUrl != undefined && style_sheet == null) 
            {
                style_sheet = new TextField.StyleSheet();
                style_sheet.load(CssUrl);
              }
            if (htmlComponent == undefined)
            {
                createLabel("htmlComponent", 1);
            }
            htmlComponent.html = true;
            htmlComponent.border = false;
            htmlComponent.multiline = true;
            htmlComponent.wordWrap = true;
            htmlComponent.selectable = true;
            htmlComponent.background = false;
            htmlComponent.styleSheet = style_sheet;
            size();
     
     
        }
     
        // note that setSize is implemented by UIComponent and calls size(), after setting
        // __width and __height
        function size(Void) : Void
        {
            htmlComponent.setSize(__width-2, __height-2);
        }
     
     
     
     function Interval (str:String)
        {
        setInterval(setValue, 1000, str);
        } 
     
     
     
    ////
        function setValue(str:String, item:Object, sel:Boolean) : Void
        {
     
            // Ligne vide ou Header
            if (item == undefined) 
            {
                // Special case for headerRenderer
                htmlComponent.htmlText = str;
                previousLabel = null;
                return;
            }
     
            var columnIndex = this["columnIndex"]; // private property (no access function)
            var columnName = getDataLabel();
             var htmlFunction : Function = listOwner.getColumnAt(columnIndex).htmlFunction;
     
            if (htmlFunction != undefined) 
            {
     
                var label = htmlFunction(item, columnName);
     
                if (label != undefined) 
                {
                    // Important pour optimisation
                    // Empêche un flip-flop des images
                    if (label != previousLabel) 
                    {
     
                        htmlComponent.htmlText = previousLabel = label;
     
                    } 
                } 
                else 
                {
                    htmlComponent.htmlText = "";                
     
                }
            }
            else 
            {
                    htmlComponent.htmlText = str;    
     
            }
    }
        function getPreferredHeight(Void) : Number
        {
            if (owner == undefined) return 18;
            return owner.__height - 2;
        }
    }
    et ce qui ne marche pas exactement c'est le rafraichissement de la cellrenderer

  4. #4
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2008
    Messages : 8
    Par défaut
    et concernant la doc , tu parles de quelle doc???

  5. #5
    Rédacteur/Modérateur
    Avatar de beekeep
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Octobre 2006
    Messages
    2 005
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Octobre 2006
    Messages : 2 005
    Par défaut
    si tu utilises Flash elle s'ouvre en appuyant sur F1,

    sinon => http://livedocs.adobe.com/flash/8/ma...rt4_ASLR2.html

  6. #6
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2008
    Messages : 8
    Par défaut
    j'ai rien trouvé dans la doc....

  7. #7
    Rédacteur/Modérateur
    Avatar de beekeep
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Octobre 2006
    Messages
    2 005
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Octobre 2006
    Messages : 2 005
    Par défaut
    je joins un exemple d'utilisation de setInterval dans une classe. (tiré de la doc dont j'ai donné le lien)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    class CustomClass {
     private var intervalId:Number;
     private var count:Number = 0;
     private var maxCount:Number = 10;
     private var duration:Number = 20;
     
     public function CustomClass():Void {
      beginInterval();
     }
     
     private function beginInterval():Void {
      if(intervalId != null) {
       trace("clearInterval");
       clearInterval(intervalId);
      }
      intervalId = setInterval(this, "executeCallback", duration);
     }
     
     public function executeCallback():Void {
      trace("executeCallback intervalId: " + intervalId + " count: " + count);
      if(count >= maxCount) {
       clearInterval(intervalId);
      }
      count++;
     }
    }

  8. #8
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2008
    Messages : 8
    Par défaut
    j'ai déjà essayer ça et ça marche pas

    est ce je dois déclencher un dispatchenvent???, je suis débutante;

    merci d'avance

  9. #9
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2008
    Messages : 8
    Par défaut
    ou je met un delegate??

Discussions similaires

  1. Probleme de rafraichissement d'un BDGrid
    Par marmotte dans le forum Bases de données
    Réponses: 10
    Dernier message: 28/05/2004, 18h07
  2. [VB6] [Datareport] Pb de rafraichissement
    Par Gadoul dans le forum VB 6 et antérieur
    Réponses: 2
    Dernier message: 06/02/2003, 10h06
  3. Toujours un problème de rafraichissement de DBGrid
    Par tripper.dim dans le forum C++Builder
    Réponses: 4
    Dernier message: 09/12/2002, 13h15
  4. Timage rafraichissment
    Par Rizzla dans le forum Composants VCL
    Réponses: 5
    Dernier message: 16/09/2002, 17h08
  5. Réponses: 9
    Dernier message: 12/08/2002, 07h38

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo