0

I need help with my Array function. I am trying to create a headline for a website, but it is only the first letter that is being shown:

Screenshot

This is my code:

import fl.transitions.*;
import fl.transitions.easing.*;

var textArray:Array=["W","e","l","c","o","m","e"];

var tformat:TextFormat = new TextFormat();
tformat.color=0x0000CC;
tformat.font="Arial";
tformat.size=40;

var XPosition:Number=100;
var YPosition:Number=12;
var setPosition:Number=36;

function beginPlacement() {        
    var textfield:TextField = new TextField();
    textfield.text=textArray.shift();
    textfield.setTextFormat(tformat);
    var clip:MovieClip=new MovieClip ;
    clip.addChild(textfield);
    clip.x=XPosition;
    clip.y=YPosition;
    addChild(clip);
    var transManager:TransitionManager=new TransitionManager(clip);
    transManager.startTransition({type:Photo, direction:Transition.IN, duration:.3, easing:None.easeNone});
    transManager.startTransition({type:Zoom, direction:Transition.IN, duration:.3, easing:Elastic.easeOut});

    transManager.addEventListener("allTransitionsInDon e", tComplete);
    XPosition=+ XPosition+setPosition;
}

function tComplete(e:Event):void {
    if (textArray.length>0) {
        beginPlacement();
    }
}

beginPlacement();
honk
  • 9,137
  • 11
  • 75
  • 83
J.Hage
  • 13
  • 5
  • https://i.gyazo.com/d56034f494b134b590e7a25d214c3de9.png This is an example for what is happening. – J.Hage Apr 13 '16 at 09:04
  • Is "allTransitionsInDon e" a typo? – Yasuyuki Uno Apr 13 '16 at 09:17
  • I am going to give you a really bad answer now... To be quite honest I dont know... I am not that good in ActionScript 3, and I am basically "Copying" other codes, to see if I can learn from it... I am sorry. – J.Hage Apr 13 '16 at 09:32
  • Change "allTransitionsInDon e" to "allTransitionsInDone", and retry. – Yasuyuki Uno Apr 13 '16 at 09:38
  • Haha... Thank you so much... But can you help me with another problem? Why is the letter far away from each other? https://gyazo.com/aa8f472efe408eda0f01722b31240acd – J.Hage Apr 13 '16 at 09:41
  • Your letters position is setting here `XPosition=+ XPosition+setPosition; // previousLetter.x+100`. But I think you have to adjust the position considering letter width, or any other solution.(ex. The width of "W" and "e" are difference) – Yasuyuki Uno Apr 13 '16 at 10:13
  • I am struggling finding a solution.. – J.Hage Apr 13 '16 at 11:18
  • As a question for Stackoverflow, you need to put in a bit more work: what have you already tried, what effect did that have, what have you [searched and researched](/help/how-to-ask) about the functions you used and why you think what you want to do requires the code you wrote. Right now, your question is just "what is wrong?" and a code dump... that is not a good way to ask a question. – Mike 'Pomax' Kamermans Apr 14 '16 at 01:38
  • I am so sorry, Mike... What I am struggling with - as you can see on the other gyazo picutre - is that the letter, all have different space between each other. – J.Hage Apr 14 '16 at 08:39

0 Answers0