Where should I put this piece of code AS3?

Hello

I have some code AS3 Im using a typewriter in flash effect.

It is that connects to a separate Word document that contains the text, I would like to use.

I know that the use of the character/n is a 'new line', but I can't place the code inside the text document. I found the following code which should help me add the line break, where I need:

If (PosCar == XX) {}
varString += "\n";
}

However, I do not know where abouts in my code, this should go? Ive tried to add in it but I keep getting errors. My code is:

var myText:String;
var count: int = 0;


var format: TextFormat = new TextFormat();
format. Size = 14;
format.font = "Georgia."
format. Color = 0xFFFFFF;
format. Leading = 1;
format.letterSpacing = 0.6;


var textField: TextField = new TextField();
textField.width = 400;
textField.height = 400;
textField.selectable = false;
textField.wordWrap = true;
textField.defaultTextFormat = format;
textField.x = 83;
textField.y = 127;
addChild (textField);


var textLoader:URLLoader = new URLLoader (new URLRequest ("http://www.securedbystothard.com/images/flash_banners/text1.txt"));
textLoader.addEventListener (Event.COMPLETE, function(e:Event){initText(e.target.data);});)


function initText(string:String):void {}
myText = string;
addEventListener (Event.ENTER_FRAME, writeText);
}



function writeText(e:Event):void {}
If (counter < = myText.length) {}
textField.text = myText.substr(0,counter);
counter ++;
}
else {}
removeEventListener (Event.ENTER_FRAME, writeText);
}
}


Someone would be able to tell me where I put the code I found?

Thank you

Shaun.

Here's another approach that uses myText as table with the same effect:

import flash.events.Event;
//var myText:String;
var myText:Array;
var counter:int = 0;

var format:TextFormat = new TextFormat();
format.size = 14;
format.font = "Georgia";
format.color = 0x000000;
format.leading = 1;
format.letterSpacing = 0.6;

var textField : TextField = new TextField();
textField.width = 400;
textField.height = 400;
textField.selectable = false;
textField.wordWrap = true;
textField.defaultTextFormat = format;
textField.x = 83;
textField.y = 127;
addChild(textField);

var textLoader:URLLoader = new URLLoader();
textLoader.addEventListener(Event.COMPLETE, initText);
textLoader.load(new URLRequest("http://www.securedbystothard.com/images/flash_banners/text1.txt"));

function initText(e:Event):void {
     myText = e.target.data.replace(/\|/g, "\n").split("");
     addEventListener(Event.ENTER_FRAME, writeText);
}

function writeText(e:Event):void{
     if (counter < myText.length){
          //textField.text = myText.substr(0,counter);
          textField.appendText(myText[counter]);
          counter++;
     }
     else{
          removeEventListener(Event.ENTER_FRAME,writeText);
     }
}

Tags: Adobe Animate

Similar Questions

  • Hyperlink button - where should I put the code?

    Hello

    I am using Actionscript 3 in CS4

    I want to add a hyperlink link button to my site, but it keeps buggered it up to the flow.

    Here is the code for my site so far (less the binding code):

    ---------------------------

    Stop();
    function trans(event:MouseEvent):void {}
    gotoAndPlay (event.target.name);

    }

    karaoke.addEventListener (MouseEvent.CLICK, trans);
    trivia.addEventListener (MouseEvent.CLICK, trans);
    gilbert.addEventListener (MouseEvent.CLICK, trans;

    ----------------------------

    So, there are three menu buttons and page animations according to the button flys.

    I have another button called LINK, and I thought it would be just a matter of inserting the following code somewhere:

    {LINK.onRelease = function ()}
    getURL ("http://www.gilbert.net.au");
    }

    But no matter where I put it, it is simply my site play through all the animations of one after the other, no matter if the buttons were clicked or not, and the link does not work.

    Where should I put this code is correct?

    In addition, once it works, I want to copy it and make another button to create an email.  Is it just a matter of having a mailto link: link instead of a hyperlink?

    Cheers for your help.

    Shaun

    Your mixture with AS2 AS3.  The first code that show you is AS3, AS2 LINK stuff...

    function getGilbert(evt:MouseEvent):void {}
    navigateToURL (new URLRequest ("http://www.gilbert.net.au"));
    }

    LINK.addEventListener (MouseEvent.CLICK, getGilbert);

  • where should I put the "" XML: Space = preserve ".

    Hello

    I use FM12. I want to keep empty lines (and several [shift + return] line breaks between the text of the code).

    If FM12 import my XML file, additional line breaks will be removed.

    In the read/write rules, I placed a statement

    element {'Code'

    drive line break is forced return

    }

    has not worked for me.

    In FM help files, I found the following trick: "place an attribute XML: Space ="preserve"to the item...» »

    My Question: Where should I put this attribute?

    1.) in the DTD file?

    (2.) in the file of ESD?

    (3.) in read/write rules?

    4.) in an additional configuration file?

    Thanks for any help!

    M.

    Hi Mathias...

    I use it...

    element 'codeblock' {}

    newline writer is 99999 characters;

    drive line break is forced to return;

    }

    but I think you can use it as well...

    element 'codeblock' {}

    keep line breaks;

    }

    To include the attribute XML: Space, you would add which both the EDD and the DTD.

    See you soon,.

    .. .Scott

  • where should I put the code to make a sensitive BC site

    Where should I put the following code to make my current sites of BC 'Sensitive' for the forthcoming update of the Google algorithm.

    link rel = "stylesheet" type = "text/css" href="/css/{system_visitorDeviceClass}.css

    Thank you

    Hey there,

    It doesn't really work like that.

    Receptive happens by CSS, Yes, but you can do it simply with queriers media CSS. You just pasted here partial html to an element of the stylesheet - that would go in head code in templates. But that is all down to the site and the installation program. Some people do not use models BC and have all file flat, others may have includes or supports for the content of the content header.

    You should also read the google algorithm code and that means properly. Half understand this kind of thing creates all the incorrect myths about SEO and ranking.

  • Prevent page caching... where should I put the code

    I have a page that creates a record. If the user clicks on the back button of the browser, they reach a new record for the same account. In this file, there are multiple records with STATUS = NO. But what a 'YES '. I fixed it by checking if there is a record for the account with STATUS = Y, but users can still enter a bogus STATUS = N.

    So I want to disable the cache for this page that the user cannot return to the page. I think I understand how to do it, but another thread has recommended this page.

    http://www.htmlgoodies.com/beyond/reference/article.php/3472881

    The author says to put the code below in the footer, as IE has a bug if the code is in the header that allows the page cached anyway. So I see the
    Header HTML on the edit page section, but I do not see a HTML page footer section. Where should I put it?

    < HEAD >
    < META HTTP-EQUIV = "Pragma" CONTENT = "no-cache" >
    < META HTTP-EQUIV = "Expires" CONTENT = "-1" >
    < / HEAD >
    < / HTML >

    TIA,

    Sam

    Sam,

    You have listed the steps (1-5) involve the use of links from the developer toolbar, the edit page Builder, and Builder, is set - this exact Page links? That seems like an artificial way to illustrate a problem you want to prevent end users from their experience. Also, the description of each step is not clear for me.

    Here's what I can tell you:

    1. If the user uses the back button on the browser, but a page, the page may re-submit. Nothing you can do about it (assuming that your meta-tags failed).

    2. If you use the feature to duplicate presentations Page of the form pages, you can prevent cached browser pages to run after - submit actions (such as DML) if these pages are subjected to a second time.

    Scott

  • Portege M400: Where should I put the PIN for the Sim Card?

    I had the Tablet, I got the SIM... I turned on the wireless wan.

    Now, where should I put the pin code of the card?

    See you soon,.
    Miguel

    Hello

    You have installed the software from MobilLink?
    I m not a PortegeM400 owner but several owners of m400 reported this tool lets you connect to networks G3

  • Re: Portege R500: where should I put the SIM card?

    Hello

    can someone help me? Where should I put the SIM card? The user manual make no mention of this.

    Thank you.
    Bruno.

    Hello

    I hope that the answer to your question, you can find HERE

    Good bye

  • where should I enter the editor activation code for the creative cloud

    Where should I enter the editor activation code for the creative cloud?

    Your subscription to cloud shows correctly on your account page?

    If you have more than one email, you will be sure that you use the right Adobe ID?

    https://www.adobe.com/account.html for subscriptions on your page from Adobe

    If Yes

    Some general information for a subscription of cloud

    Cloud programs don't use serial... numbers you, connect you to your cloud account paying to download & install & activate... you may need to sign out of the cloud and restart your computer and log into the cloud for things to work

    Sign out of your account of cloud... Restart your computer... Connect to your paid account of cloud

    -Connect using http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html

    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html

    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html

    -ID help https://helpx.adobe.com/contact.html?step=ZNA_id-signing_stillNeedHelp

    -http://helpx.adobe.com/creative-cloud/kb/license-this-software.html

    If no

    This is an open forum, Adobe support... you need Adobe personnel to help

    Adobe contact information - http://helpx.adobe.com/contact.html

    -Select your product and what you need help with

    -Click on the blue box "still need help? Contact us. "

  • Agent JAVA EE - where should I put third party jdbc database drivers?

    Hello

    I need to move from stand-alone agent to ee java agent deployed on weblogic server. This is my independent agent configuration:
    -jdbc drivers of third-party required for integration with third party database servers: mysql and firebird. When you use autonomous agent, I put the driver files corresponding to the directory of the agent/drivers and it works. Where should I put third-party drivers to make them visible to java ee officer?
    -configuration of the agent of database coneection: non-standard options you need. When you use autonomous agent, I need to change some of the options in the agent/bin/odiparams.sh file:
    ODI_CONNECTION_RETRY_COUNT = 1000
    ODI_CONNECTION_RETRY_DELAY = 7000
    How to install agent java ee in the same way? Is this possible? I need my agent to connect to the repository (oracle database) in the case where when the connection is lost.

    Can you help me?

    You can add the jars to D:\Oracle\Middleware\wlserver_10.3\server\ext
    and then add the path of the driver jar at the entrance WEBLOGIC_CLASSPATH in the location of the commonEnv.bat file in the folder bin (D:\Oracle\Middleware\wlserver_10.3\common\bin).
    Restart the server instance.

    Chantal
    http;//dwteam.in

  • Where should I put the functions I want to make it public?

    I put one in creationComplete and I can't call from the timeline. I would like to call from various locations on the timeline.

    Where should I put these functions?

    Thank you.

    Ken

    Hello

    Take a look at this thread: Re: how to create and call functions on the symbols?

    Thank you and best regards,

    Roger Simon

  • Where should I put my files .8bf in CC

    Hi all

    I'm sorry - I know that it is pretty basic!

    On a 64-bit Windows 7 system where should I put my .8bf files?

    I did a search of my folder of files of programs (not x 86) and it came with a folder that had some files in (C:\Program Files\Adobe\Adobe Photoshop CC (64 Bit) \Required\Plug-Ins\Filters), but when I put filters in this case that they still do not appear in the menu filters in photoshop.

    I know that it is quite possible that the filters I tried are not compatible with the CC (they worked with CS5.5) but I want to know that I tried at least the good folder.

    TIA

    John

    Folder "\Plug-ins Adobe\Adobe Photoshop CC (64-bit)" and 32 bit a go in "Adobe\Adobe Photoshop CC\Plug-ins".

  • Why this piece of code does not work?

    Hello everyone, I am new to HTML and web design, and I'm doing a website. I created this piece of code so that when the user mouse over one of the links (jpg image) it will change the colors (I have the same image in different colors saved in the same folder).

    < ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
    " < html xmlns =" http://www.w3.org/1999/xhtml ">
    < head >
    < meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"
    < title > < /title > XXXXXXXXXX
    < / head >

    < body bgcolor = "#000000" >
    < table width = "1050" border = "0" align = "center" cellpadding = "0" cellspacing = "0" >
    < b >
    < td > < table width = "1050" border = "0" cellspacing = "0" cellpadding = "0" >
    < b >
    < td > < img src = "_images/XXXXbanner.jpg" width = "1050" height = "311" alt = "banner" / > < table > "
    < /tr >
    < /table >
    < table width = "901" border = "0" align = "center" cellpadding = "0" cellspacing = "0" >
    < b >
    < td width = "150" > < a href = "index.html" Mm_swapimgrestore"onMouseOver =" MM_swapImage ('ButtonOne' ", ' _images/home_on.jpg', 1)" > "
    < img name = "ButtonOne" border = "0" src = "_images/home.jpg" width = "150" height = alt "75" = "home" / > < /a > < table > "
    < td width = "150" > < a href = "gallery.html" Mm_swapimgrestore"onMouseOver =" MM_swapImage ('ButtonTwo' ", ' _images/gallery_on.jpg', 1)" > "
    < img name = "ButtonTwo" border = "0" src = "_images/gallery.jpg" width = "150" height = "75" alt = "Gallery" / > < /a > < table > "
    < td width = "150" > < a href = "products.html" Mm_swapimgrestore"onMouseOver =" MM_swapImage ('ButtonThree' ", ' _images/product_on.jpg', 1)" > "
    < img name = "ButtonThree" border = "0" src = "_images/product.jpg" width = "150" height = "75" alt = "products" / > < / a > < table > "
    < td width = "150" > < a href = "store.html" Mm_swapimgrestore"onMouseOver =" MM_swapImage ('ButtonFour', ", ' _images/shop_on.jpg', 1)" > "
    < img name = "ButtonFour" border = "0" src = "_images/shop.jpg" width = "150" height = "75" alt = "store" / > < /a > < table > "
    < td width = "150" > < a href = "profile.html" Mm_swapimgrestore"onMouseOver =" MM_swapImage ('ButtonFive' ", ' _images/profile_on.jpg', 1)" > "
    < img name = "ButtonFive" border = "0" src = "_images/profile.jpg" width = "150" height = "75" alt = "profile" / > < / a > < table > "
    < td width = "151" > < a href = "contactus.html' Mm_swapimgrestore" onMouseOver ="MM_swapImage ('ButtonSix',", ' _images/contact_us_on.jpg', 1) ">"
    < img name = "ButtonSix" border = "0" src = "_images/contact_us.jpg" width = "150" height = "75" alt = "contact" / > < /a > < table > "
    < /tr >
    < /table >
    < table width = "1050" border = "0" cellspacing = "0" cellpadding = "0" >
    < b >
    < td > < table >
    < td > < table >
    < td > < table >
    < /tr >
    < /table >
    < p > < / p >
    < p > < /p > < table >
    < /tr >
    < /table >
    < / body >
    < / html >

    images and the banner appear thin and I do not have mistpyed one of the names of places/file. Why the icon does not change the colors (show image 'on') when you pass the mouse over it? Please help thanks in advance.

    * I use Adobe Dreamweaver CS4

    The head of your page contains no MM_swapImgRestore() or MM_swapImage() functions that are called by your code.

    Not sure how you have added the Beahviors yoru page.  If you have used the window of behaviours, DW should have added scripts to yoru page for you.  If you have added the code manually, then you will need to add the scripts manually.  But the easiest thing would be to simply add the behaviors of another link on the page, even a dummy, you can remove later.  This should get the scripts in the head for you.

    --

    E. Michael Brandt

    www.divaHTML.com
    www.divahtml.com/Products/scripts_dreamweaver_extensions.php
    According to the standard scripts and the Dreamweaver Extensions

    www.valleywebdesigns.com/vwd_Vdw.asp
    JustSo PictureWindow
    JustSo PhotoAlbum, and alia

    --

  • How do I know how is Administrator and where should I put the password to?

    My computer keeps asking for a password
    I have 3 standard users on my computer & no one is assigned to be administrator
    Cannot install updates because do not know or do not have a password
    How do I know how is Administrator and where should I put the password to?

    Hello

    The manual installation of the operating system on the Microsoft Update Web site updates requires the Office of the operating system to run with administrative rights.

    Please follow the steps mentioned below.

    a. click the Start button.

    (b) in the search box of start, type user accounts and click on user account.

    c. click on Manage.

    d. check which account is designated as administrator account.

    Also check out the links below.

    Why use a standard account instead of an administrator account?

    http://Windows.Microsoft.com/en-us/Windows-Vista/why-use-a-standard-user-account-instead-of-an-administrator-account

    What is an administrator account?

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-is-an-administrator-account

    Change the type of user account

    http://Windows.Microsoft.com/en-us/Windows-Vista/change-a-users-account-type

    Install Windows updates

    http://Windows.Microsoft.com/en-us/Windows-Vista/install-Windows-updates

    Updates: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows-Vista/updates-frequently-asked-questions

  • DirectX June 2010 asking where to put the extracted files. Where should I put them?

    DirectX June 2010 asking where to put the extracted files. Where should I put them?

    Create a new folder and extract the files to the new folder.

    Let us know if that helps.

  • Can this piece of code be improved?

    DB version: 11.2


    I'm not an expert in PL/SQL.

    Since then, we treat (an UPDATE) about 7 million records per batch run, our developer has decided to put this in a loop that will process 1 million per iteration (rownum < 1000001).

    -excerpt from our stored procedure in question
    while var_cnt != 0
     
              loop
                    select count(1) into var_cnt from shp_dtl a where  
                     a.region_code = p_rgn_code
                     and a.shp_date = p_date
                     and exists (select 1 from shp_status_dtl b where b.map_no = a.cd_map_no and a.region_code = b.country_code
                     and b.ema_revise_date != p_date);
    
                begin
    
    
                  update shp_status_dtl a set
                               .
                               .
                               .
                               ;
    
                commit;
    
                exception
                when others then
                raise;
                end;
    end loop;
    I know you gurus dislike engages in a loop. But we're COMMITin that each million documents.

    No room for improvement for the piece above the code?

    If the update is short of UNDO, accordingly increase the UNDO tablespace.

    In addition, this update could be rewritten as a merger, something like:

    merge into shp_status_dtl a
    using (select cd_contact_person
           from   shp_dtl
           where  region_code = p_rgn_code
           and    shp_date = p_date) b
      on (a.country_cod = b.region_code
          and a.map_no = b.cd_map_no)
    when matched then
    update a.ema_revise_date = p_date,
           a.contact_person = b.cd_contact_person
    where  a.ema_revise_date != p_date;
    

    NB. No test!

Maybe you are looking for