variable and as3 question text

Hello

I have three vars:

var textMessage1 = "Text 1";

var textMessage2 = "Text 2";

var textMessage3 = "Text 3";

I have an another var that increases it's the value by one whenever I run across a particular setting:

nextText = 1;

I have a text box - textBox - I want to display 'Text 1' if nextText = 1, or "text 2" If nextText = 2. "

I can't get the TextBox to display what I want (it is formatted and everything has been set up to properly, of type textBox.text = "blah", shows "blah".)

This is incorrect, but how do I display - textBox.text = [text + nextText];  ?

I tried textBox.text = ['text' + nextText]]; but I'm told there is no such variable as text message, it's true.

I tried different versions of the above, but I don't have this right - of ideas how to?

Thank you

Shaun

use:

var tl:MovieClip =;

var textMessage1 = "Text 1";

var textMessage2 = "Text 2";

var textMessage3 = "Text 3";

textBox.text = tl ["text" + nextText];

Tags: Adobe Animate

Similar Questions

  • Question of variables and file download.

    Hello

    I have a uploader of file in AS3 and can successfully save a file using php.

    I would also like to send variables with the file, php to process variables and display in Flash.

    Separated, I was able to include flash-flash-php variables in a project, but I can't work on how to do this while also downloading a file.  I get a null reference error in the completeHandler function when flash tries to display the reactive power coming back from php.

    Here is my AS3:

    create a file from a string of text, it records, the bed, then download:

    var newFile:File;

    newFile = File.desktopDirectory.resolvePath ("my.xml");
    var stream: FileStream = new FileStream();
    Stream.Open (newFile, FileMode.WRITE);
    stream.writeMultiByte (str, "utf - 8")
    Stream.Close ();
    stream.openAsync (newFile, FileMode.READ);

    stream.addEventListener (Event.COMPLETE, uploadFile);

    function uploadFile(evt:Event):void {}

    var URLrequest:URLRequest = new URLRequest ("http://www.mysite.com.au/uploader_script.php");
    var variables: URLVariables = new URLVariables();
    variables.todayDate = new Date();
    variables. Name = "Dude."
    variables. Email = "[email protected]"; ""
    variables.saveThisXML = "test record this";
    variables.passwordString = 'parse ';
    URLrequest.method = URLRequestMethod.POST;
    URLrequest.data = variable;

    newFile.addEventListener (Event.COMPLETE, completeHandler);
    newFile.addEventListener (ProgressEvent.PROGRESS, progressHandler);
    newFile.upload (URLrequest);

    }

    function completeHandler(evt:Event):void {}

    var phpVar1 = evt.target.data.var1;
    var phpVar2 = evt.target.data.var2;

    result1_txt. Text = phpVar1;
    result2_txt. Text = phpVar2;

    uploaderMC.status_txt.text = newFile.name + 'has been uploaded.';

    }

    My PHP:

    <? PHP

    $Name = $_POST ['name'];
    $filename = $_FILES ['Filedata'] ['name'];
    $filetmpname = $_FILES ['Filedata'] ['tmp_name'];

    $uname = $_POST ['email'];

    Print two vars back-Flash, you can also use 'echo' instead of printing
    print ' var1 = the domain name with a variable of $uname was sent to PHP and is back.';
    print '& var2 = $uname is also defined in the variable 2 php.';

    File on the server:
    move_uploaded_file ($_FILES ['Filedata'] ['tmp_name'], $filename);

    ? >

    It works fine download, but falls into the AS3 to var phpVar1 = evt.target.data.var1;

    Is there an obvious reason that I'm missing?

    Thanks for your time.

    Shaun

    Add your variables in your URLs and use $_GET in your php file to analyze the variables:

    create a file from a string of text, it records, the bed, then download:

    var newFile:File;

    newFile = File.desktopDirectory.resolvePath ("my.xml");
    var stream: FileStream = new FileStream();
    Stream.Open (newFile, FileMode.WRITE);
    stream.writeMultiByte (str, "utf - 8")
    Stream.Close ();
    stream.openAsync (newFile, FileMode.READ);

    stream.addEventListener (Event.COMPLETE, uploadFile);

    function uploadFile(evt:Event):void {}

    var URLrequest:URLRequest = new URLRequest ("http://www.mysite.com.au/uploader_script.php?var1=" + all + "& var2 =" + whateverelse);
    var variables: URLVariables = new URLVariables();
    variables.todayDate = new Date();
    variables. Name = "Dude."
    variables. Email = "[email protected]";
    variables.saveThisXML = "test record this";
    variables.passwordString = 'parse ';
    URLrequest.method = URLRequestMethod.POST;
    URLrequest.data = variable;

    newFile.addEventListener (Event.COMPLETE, completeHandler);
    newFile.addEventListener (ProgressEvent.PROGRESS, progressHandler);
    newFile.upload (URLrequest);

    }

    function completeHandler(evt:Event):void {}
           
    var phpVar1 = evt.target.data.var1;
    var phpVar2 = evt.target.data.var2;
       
    result1_txt. Text = phpVar1;
    result2_txt. Text = phpVar2;
     
    uploaderMC.status_txt.text = newFile.name + 'has been uploaded.';

    }

    My PHP:

    <>


    $var1 = $_GET ['var1'];

    $var2 = $_GET ['var2'];

    $Name = $_POST ['name'];
    $filename = $_FILES ['Filedata'] ['name'];
    $filetmpname = $_FILES ['Filedata'] ['tmp_name'];

    $uname = $_POST ['email'];

    Print two vars back-Flash, you can also use 'echo' instead of printing
    print ' var1 = the domain name with a variable of $uname was sent to PHP and is back.';
    print '& var2 = $uname is also defined in the variable 2 php.';

    File on the server:
    move_uploaded_file ($_FILES ['Filedata'] ['tmp_name'], $filename);

    ?>

  • Variables and text input events

    Hello

    I am not new to Flash or AS3 but I never really did anything too complex. I made a Flash game and get to know the Variables for the first time. Online tutorials confuse me because they are mostly oriented AS2 and I bought this book (which is awesome) Game Design with Flash, but it only covers variables involving numbers and a guessing game.

    All I want right now is a field to enter your name and below, whatever the user has entered, will be displayed in a dynamic text field that will go, ' Oh, if your name is (whatever)? I understand that the information that the user types into the input text field must be entered in some way, so I have to make a function to make it work with a button? For now, I can type in the entry, but nothing appears in the dynamic text field.

    I borrowed an AS3 example elsewhere on this forum and add my own Instance names. I also wanted to know, how can I call the name of the user during the game? Follow this same variable upward?

    Here's what I have:

    Stop();

    var myName:String;

    myName = userName.text;

    confirm_txt. Text = "so your name is ' + MyName;

    I get no errors, but the dynamic text box does not appear as I type... How can I go on "seizure" the name while it appears and I can call anytime during the game?

    Thank you in advance for any help offered!

    "inputField.type = TextFieldType.INPUT; > Assignment Variable function name? »

    No, this says that this text field can accept keyboard entries.

    "function onInput(e:TextEvent):void".
    {
    outputField.text = "You entered" + inputField.text;
    } > You made the feature so that it works on the input box? Not the output? But the text comes out on the output? »

    This function is called when the TextEvent ENTRY is distributed by inputText TextField.

    addChild is a method that adds objects to display the object and makes them visible.

    If you replace the variables created dynamically by TextField you place on the scene manually - things will work the same. Just give them the same names as in the code and specify the text field where the user types is an input field.

    Feels like you will benefit greatly from reading about the basics of AS3 and Flash.

  • How to use text variables and the Image for printing

    I work for several months on the product with AS3 Configurator.
    I am not competent with AS3.
    Now, it seems that perhaps my design is all wrong.
    Is there a good way to do this?

    I have a main scenario that has video clips showing images of different options for the product.
    On the first image, I use buttons to select the choice for option 1 of the Option1_mc.
    Can I store the selection in a variable.
    I use a button to go to the next choice (screen 10.)

    On frame 10, I use buttons to select the choice of option 2 in the Option2_mc.
    It is stored in another variable.

    There are about 10 options that are selected and stored in variables.
    Some are text values and other images taken from video clips Option instances.

    I made a Print_mc to use to printjob.
    I can't get the values of the variables to display the first image for printing.

    Any helpl would be appreciated.

    You are welcome.

    you will not be able to insert a variable into a textfield.  you are going to assign to the text of your TextField property set to one of your points of variables to.

    Thus, for example, if you have:

    var var1:String = 'this is a test ';

    You can use:

    TF. Text = var1;

  • How the names of variables and units used in the binary output file

    My colleague will give me LabView generated from the binary files (*.dat). There are more than 60 variables (columns) in the binary output file. I need to know the names of variables and units, which I think he has already configured in LabView. Is there a way for him to produce a file that contains the name of the variable and unity, so that I'll know what contains the binary file? It can create an equivalent ASCII file with a header indicating the name of the variable, but it does not list the units of each variable.

    As you can tell I'm not a user of LabView, so I apologize if this question makes no sense.

    Hi KE,.

    an ASCII (probably the csv format) file is just text - and contains all data (intentially) written to. There is no special function to include units or whatever!

    Your colleague must save the information it records the names and values in the same way...

    (When writing to text files, it could use WriteTextFile, FormatIntoFile, WriteToSpreadsheetFile, WriteBinaryFile even could serve...)

  • Script errors and a question

    //Created by Daryl R. Smith
    //This is the tab for Totes
    
    #target illustrator
    
    var thisDoc = app.activeDocument;
    
    if (thisDoc.selection.length > 0)
    {
    
    var w = new Window ("dialog", "Choose Totes Template", undefined, {closeButton: false});
    w.alignChildren = "right";
    
                  w.onShow = function()
                    {  
    
                        for(var i=0; i<totes1.children.length; i++)
                {  
                    var thisPanel2 = totes1.children[i];  
                    thisPanel2.originalLocation = [thisPanel2.location[0], thisPanel2.location[1]];  
                }//end for
            
            }//end on show function
        
    var tpanel = w.add ("tabbedpanel");
    tpanel.size = [400, 520]; 
    
    
    //**********************************************************************************************************************************************************
    //******************************************************Section to setup the Totes Tab******************************************************************
    //**********************************************************************************************************************************************************
    
    //creates the Totes Tab
    var totesTab = tpanel.add ("tab", undefined, "Available Totes");
    totesTab.orientation = "column";
    
    //Creates first Row Group for Totes, contains panels 1,2 and 3
    var TotesGroup = totesTab.add("group",undefined);
            TotesGroup.orientation = "row";
            TotesGroup.alignChildren = "left";
    
    //first Totes Panel
    var totes1 = TotesGroup.add ("panel", undefined, "");
    totes1.alignChildren = "left";
    totes1.size = [300,480];
    
    
    var docSelection = app.activeDocument.selection;
    var newGroup = app.activeDocument.groupItems.add();
    
    for ( i = 0; i < docSelection.length; i++ ) {
       var newItem = docSelection[i] ();
    newItem.moveToEnd( newGroup );
    }
        
       alert (thisDoc.selection.length)
    
    GetToteTempNames()
    
    function GetToteTempNames()
    {  
        
        //Replace this address for the "toteTempPath" to the folder that has all the templates it in it, then the for loop will place them all
        //into a radio button array for the user to choose which one they want.  This updates everytime that this script is ran so if
        //one if removed or added it will show up reducing the amount of required time needed to update the script.
        //when replaced make sure to change the \ marks to / marks or it will not work.
        
      var toteTempPath = Folder ("Z:/  Vitronic Master Templates/STE2 Templates/TOTES & BAGS");   
      var toteTempFiles = toteTempPath.getFiles();  
      var TotenamesArr = [];  
      for(var i=0; i<toteTempFiles.length; i++){  
      var thisToteFile = toteTempFiles[i];  
      TotenamesArr.push(thisToteFile.displayName); 
      }  
    
      return TotenamesArr;  
    }  
    var totesarr1 = GetToteTempNames();
    
            for(var i=0; i<totesarr1.length; i++){  
                var lbl = totes1.add("radiobutton", undefined, totesarr1[i]);  
            }  
        
            var scrl = TotesGroup.add('scrollbar'); scrl.size = [20, 480];  
              
            scrl.onChange = scrl.onChanging = function()
            {  //start function
                for(var i=0; i<totes1.children.length; i++)
                {  //start for
                    var thisPanel2 = totes1.children[i];  
                    var xLoc = thisPanel2.originalLocation[0];  
                    var yLoc = thisPanel2.originalLocation[1];  
                    thisPanel2.location=[xLoc, yLoc-((this.value/100) * ((totes1.children.length*27.5) - (scrl.size[1]+5)))];  
                    // These numbers are my arbitrary way of setting the y location  
                    }//end for loop
                }//end function
            
           totes1.children[0].value = true;
            
            var bottombuttons = w.add ("group");
            bottombuttons.orientation = "row"
            
            var rsize = bottombuttons.add ("panel", undefined, "Resize Artwork?");
    rsize.alignChildren = "left"
    rsize.orientation = "column"
    
    rsizeyes = rsize.add ("radiobutton", undefined, "Yes");
    rsizeno  = rsize.add ("radiobutton", undefined, "No");
    
    rsize.children[1].value = true;
    
    
    var kbottombuttons = bottombuttons.add ("group", undefined, "")
    kbottombuttons.orientation = "column"
    kbottombuttons.add ("button", undefined, "Ok");
            
    
     //**********************************************************************************************************************************************************
    //********************This section is for the functions to output your choice then run the function depending on the choice you made****************
    //**********************************************************************************************************************************************************
    
    if (w.show () == 1)
    {
        
    var templateselected = selected_rbutton
    
    var requestedtemplate = selected_rbutton (totalgroups)
    
    var confirmed = confirm ("You picked [ " + selected_rbutton (totalgroups) +" ]"+ "\nYou picked [ " + questionResize (rsizechoice) + " ] to resize" + "\n" +"\nContinue?");
            confirm.noAsDflt == false;
            
            if (confirmed == true)
            {
                
                
                copy();
                openTemp ();
                paste();
                centerArt ();
                resizeart ();
                savefile ()
               //need to wait for the save script to finish before it does the put name so that if the user changes the file name from the save pallet it will be reflected
               //in the putname function.
               
               wait = savefile();
    while(!wait) {
        //wait = false; // this is just killing time  
        // so is this
        a++;     
          
        if (a>1000) break; // guard against infinite loop  
    }  //end wait
               
                putname ();
                
             } /*end if */ else
         {
             alert ("You chose not to continue, script stopped")
             }//end else
    }//end if OK
    
    
    //**********************************************************************************************************************************************************
    //*********This section is for the function to check which option for resize gets pressed and returns the text to a variable for output******************
    //**********************************************************************************************************************************************************
    
    var rsizechoice = [rsize]
    
    function questionResize (rsizechoice)
    {//start function
    //when choice is pressed return choice text for variable output    
    for (var i = 0; i < rsize.children.length; i++)
    {
    if (rsize.children[i].value == true)
    return rsize.children[i].text;
    }//end for
    }//end function QuestionResize
    
    
    //**********************************************************************************************************************************************************
    //***************************************************************This is the section that will center the artwork ******************************************
    //**********************************************************************************************************************************************************
    
         var thisDoc = app.activeDocument;
        thisDoc.rulerOrigin = [0,0];  //  Sets the coordinates of the artboard to the lower left hand corner of the document.
        thisDoc.pageOrigin = [0,0];  //  This makes sure a valid reference point is used for different sized documents.
        
        function centerArt()
       {   
           var thisdoc = app.activeDocument;  
            var selecteditem = app.activeDocument.selection;
            var hasDocCoords = app.coordinateSystem == CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
            
            
            var p = thisdoc.pageItems;  
            for (var i = 0, l = p.length; i < l; i++) {  
                var pID = p[i];  
                if (pID.guides == true) {  
                    var guideBox = pID  
                }  
            }   
            var wNum = guideBox.width;  
            var hNum = guideBox.height;
            var swNum = selecteditem.width;
            var shNum = selecteditem.height;
            
            var sxOffset = (swNum/2);
            var syOffset = (shNum/2);
            var xOffset = (wNum/2);
            var yOffset = (hNum/2);
            
            
            var xNum = guideBox.position[0]+xOffset;  
            var yNum = guideBox.position[1]-yOffset; 
            
            var guideXCenter = xNum-sxOffset;
            var guideYCenter = yNum+syOffset;
            
            var sxNum = selecteditem.position[0]+sxOffset;
            var syNum = selecteditem.position[1]-syOffset;
            
            //to test your script for position un annotate the two alerts below
            
                   alert("GuideBox Data:\nWidth: "+wNum+"\nHeight: "+hNum+"\nX Position: "+xNum+"\nY Position: "+yNum); 
                    alert ("Selected object Data:\nWidth: "+swNum+"\nHeight: "+shNum+"\nX Position: "+sxNum+"\nY Position: "+syNum);
                   
                   
            //changes the position of the selected artwork to the center of the guide box.
            app.activeDocument.selection[0].position = [guideXCenter, guideYCenter]    
        }//end centerart
    
       function resizeart()
    {
       if (questionResize (rsizechoice) == "Yes")
       {
            for (var i = 0; i < app.activeDocument.pageItems.length; i++) 
            {  
                  
                if (app.activeDocument.pageItems[i].guides == true) {  
                    var guideBoxSize = app.activeDocument.pageItems[i];  
                }  //end if
            }   //end for
            var guideW = guideBoxSize.width;  
            var guideH = guideBoxSize.height;
            
            var itemW = app.activeDocument.selection.width;
            var itemH = app.activeDocument.selection.height;
            
             //to test your script for resize un annotate the two alerts below
             
            alert ("guide is this tall " + guideH + "\nguide is this wide " + guideW);
            alert ("item is this tall " + itemH + "\nitem is this wide " + itemW);
            
            var artWidth = itemW;
            var artHeight =itemH;           
    
        if (artWidth > artHeight)
            {
               var a = (guideW/artWidth)*100;
               app.activeDocument.selection[0].resize(a,a);
             }   
        if (artHeight > artWidth)     
            {
               var b = (guideH/artHeight)*100;
               app.activeDocument.selection[0].resize(b,b);
             }
         
     var artWidth2 = itemW;
    var artHeight2 =itemH;    
    
     if (artHeight2 > guideH)
        {
           var c = (guideH/artHeight2)*100;
          app.activeDocument.selection[0].resize(c,c);
          }
            
    
         }//end if doresize
    }//end function resizeart
    
    function putname ()
    {
      
      var thisDoc = app.activeDocument;
            thisDoc.rulerOrigin = [0,0];
            thisDoc.pageOrigin = [0,0];
      
      var filename = app.activeDocument.name.replace(/\.[^\.]+$/, '');
      var createdate = app.activeDocument.modified;
      
      var  theDate = new Date();
            var day = theDate.getDate();
            var month = theDate.getMonth() + 1;
            var year = theDate.getFullYear();
            var hours = theDate.getHours();
            var min = theDate.getMinutes();
                if (min < 10)
                    min = ("0" + min);
            var morn;
                if (hours >= 12)
                    {
                        hours = hours-12;
                        morn = " PM";
                    }
                else
                    morn = " AM"
    
    var saveDate = (month + "-" + day + "-" + year + "    " + hours + ":" + min + morn );
      
      
      
    
      var nameTextFrame = thisDoc.textFrames.add();
        nameTextFrame.contents = globalartistname + "\n" + filename + "\n" + saveDate;  
        nameTextFrame.top = 1000;
        nameTextFrame.left = 100;
        nameTextFrame.filled = true; 
        nameTextFrame.alignment = "center";
        
        }//end put name
    
    function savefile ()
    {
        
        //change this folder location for the "savescript" variable to the one where the location of the save script is located on the server, 
        //This save script is for the pallet that will pop up and list the different save options, not the individual save scripts themselves.
        
            var savescript =  new File("S:/Art/ArtDept/Illustrator JS Palette/Scripts/Art Share Server/Save/Save Option Pallet");
                savescript.open("r");      
           var bt = new BridgeTalk;
                bt.target = "illustrator";          
           var script = savescript.read();
                savescript.close();               
           bt.body = script;
           bt.send();  
           
           if (saved = true)
           {
               alert("File saved")
            }
           
           if (saved == false)
           {
               alert ("File not saved")
               }
           
           return true;
     }      
    
    
    //**********************************************************************************************************************************************************
    //********************This section is for the functions to check which button gets pressed and returns the text to a variable for output ****************
    //**********************************************************************************************************************************************************
    
    
    //all radiobutton groups must be pressent in this array
    var totalgroups = [totes1]
    
    //this function checks each group for the 1 radio button is clicked then returns its text
    function selected_rbutton (totalgroups)
    {//start function to check buttons
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Totes tab buttons
    
    //when totes1 is pressed return text for output
    for (var i = 0; i < totes1.children.length; i++)
    {
    if (totes1.children[i].value == true)
    {
    return totes1.children[i].text;
    }//end if
    
    }//end if
    }//end for
    
    //////////////////////////////////////////////////////////////////////////open template 
    
    function openTemp()
     {
         //change the folder location of the templates here but leave the last section that is black, this will allow the script to open which
         //ever template they chose from the radiobuttons.  This location should be the same as the toteTempPath above but reduces the
         //chance for something to break by pulling the address here again instead of from the variable near the begining of the script.
         
     var gettotetemp = new File("Z:/  Vitronic Master Templates/STE2 Templates/TOTES & BAGS/" + selected_rbutton (totalgroups));
    
    open(gettotetemp);
    
    }//end open temp function
    
    }//end if selection check
    
    
    else
    {
        alert("Please select the artwork.");
      } // end else selection check 
    

    This is my entire script with notes to help, my script does not work it telling me there is an error on a different line every time that I run and the line indicating the error is on is something simple like .alignChildren = 'left '; I'm at a loss as to why it has stopped working.

    My question is, after I get it going again once I made a mistake when I wrote this, because I was looking at him with an element of single path to make sure that he moved to the model, resized and saved but when I try with a bunch of different objects, it breaks even if try to group them all together first.  It will not be the entire selection copy(), so I added a section to the script near the 50 line that takes all the elements of the path of the selection and puts them in a group.  I'm going on this and that and running it and test it because I had that done and I can't make it work, I am at my wits end and looking for help.

    What I need to do is the following in the correct order;

    Copy();

    openTemp ();

    Paste();

    centerArt ();

    resizeart ();

    SaveFile)

    putname ();

    separately each function works fine but when I try and put together something breaks.  I'll post the script that I use for the savefile() in the next post.

    most likely, the problem is copy(), paste(), the dough isn't reliable, instead, you can duplicate the object to a target document, then first, when you open your model, return a reference to, so you can use it to move the duplicate group.

    See my comments with @, I have use savefile() or putname(), I'm focused on resize() and center()

    //Created by Daryl R. Smith
    //This is the tab for Totes 
    
    #target illustrator 
    
    var thisDoc = app.activeDocument; 
    
    if (thisDoc.selection.length > 0)
    { 
    
    var w = new Window ("dialog", "Choose Totes Template", undefined, {closeButton: false});
    w.alignChildren = "right"; 
    
                  w.onShow = function()
                    {   
    
                        for(var i=0; i1000) break; // guard against infinite loop
    }  //end wait 
    
                //putname ();  // commented out for testing purposes only @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    
            } /*end if */ else
        {
            alert ("You chose not to continue, script stopped")
            }//end else
    }//end if OK 
    
    //**********************************************************************************************************************************************************
    //*********This section is for the function to check which option for resize gets pressed and returns the text to a variable for output******************
    //********************************************************************************************************************************************************** 
    
    var rsizechoice = [rsize] 
    
    function questionResize (rsizechoice)
    {//start function
    //when choice is pressed return choice text for variable output
    for (var i = 0; i < rsize.children.length; i++)
    {
    if (rsize.children[i].value == true)
    return rsize.children[i].text;
    }//end for
    }//end function QuestionResize 
    
    //**********************************************************************************************************************************************************
    //***************************************************************This is the section that will center the artwork ******************************************
    //********************************************************************************************************************************************************** 
    
        var thisDoc = app.activeDocument;
        thisDoc.rulerOrigin = [0,0];  //  Sets the coordinates of the artboard to the lower left hand corner of the document.
        thisDoc.pageOrigin = [0,0];  //  This makes sure a valid reference point is used for different sized documents. 
    
        function centerArt()
      {
          var thisdoc = app.activeDocument;
            //var selecteditem = app.activeDocument.selection; // [error] this throws no error here, but it does down below, selection returns an Array @@@@@@
            var selecteditem = app.activeDocument.groupItems[0]; // since you have duplicated a group, just get a reference to it @@@@@@@@@@@@
            selecteditem.selected = true; // you don't have to select items to work with them, I just selected to continue Debugging your script @@@@@@@@
            var hasDocCoords = app.coordinateSystem == CoordinateSystem.ARTBOARDCOORDINATESYSTEM; 
    
            var p = thisdoc.pageItems;
            for (var i = 0, l = p.length; i < l; i++) {
                var pID = p[i];
                if (pID.guides == true) {
                    var guideBox = pID
                }
            }
            var wNum = guideBox.width;
            var hNum = guideBox.height;
            var swNum = selecteditem.width;
            var shNum = selecteditem.height; 
    
            var sxOffset = (swNum/2);
            var syOffset = (shNum/2);
            var xOffset = (wNum/2);
            var yOffset = (hNum/2); 
    
            var xNum = guideBox.position[0]+xOffset;
            var yNum = guideBox.position[1]-yOffset; 
    
            var guideXCenter = xNum-sxOffset;
            var guideYCenter = yNum+syOffset; 
    
            var sxNum = selecteditem.position[0]+sxOffset;
            var syNum = selecteditem.position[1]-syOffset; 
    
            //to test your script for position un annotate the two alerts below 
    
                  alert("GuideBox Data:\nWidth: "+wNum+"\nHeight: "+hNum+"\nX Position: "+xNum+"\nY Position: "+yNum);
                    alert ("Selected object Data:\nWidth: "+swNum+"\nHeight: "+shNum+"\nX Position: "+sxNum+"\nY Position: "+syNum); 
    
            //changes the position of the selected artwork to the center of the guide box.
            //app.activeDocument.selection[0].position = [guideXCenter, guideYCenter]; // use the group reference instead @@@@@@@@@@@@@@@@@
            selecteditem.position = [guideXCenter, guideYCenter]; // selecteditem is the duplicated group @@@@@@@@@@@@@@@@@@@@@@
        }//end centerart 
    
      function resizeart()
    {
      if (questionResize (rsizechoice) == "Yes")
      {
            for (var i = 0; i < app.activeDocument.pageItems.length; i++)
            {   
    
                if (app.activeDocument.pageItems[i].guides == true) {
                    var guideBoxSize = app.activeDocument.pageItems[i];
                }  //end if
            }  //end for
            var guideW = guideBoxSize.width;
            var guideH = guideBoxSize.height; 
    
            //var itemW = app.activeDocument.selection.width;  // selection returns an array @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            //var itemH = app.activeDocument.selection.height;  // same as above @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            var itemW = app.activeDocument.selection[0].width;
            var itemH = app.activeDocument.selection[0].height; 
    
            //to test your script for resize un annotate the two alerts below 
    
            alert ("guide is this tall " + guideH + "\nguide is this wide " + guideW);
            alert ("item is this tall " + itemH + "\nitem is this wide " + itemW); 
    
            var artWidth = itemW;
            var artHeight =itemH;           
    
        if (artWidth > artHeight)
            {
              var a = (guideW/artWidth)*100;
              app.activeDocument.selection[0].resize(a,a);
            }
        if (artHeight > artWidth)
            {
              var b = (guideH/artHeight)*100;
              app.activeDocument.selection[0].resize(b,b);
            } 
    
    var artWidth2 = itemW;
    var artHeight2 =itemH;     
    
    if (artHeight2 > guideH)
        {
          var c = (guideH/artHeight2)*100;
          app.activeDocument.selection[0].resize(c,c);
          } 
    
        }//end if doresize
    }//end function resizeart 
    
    function putname ()
    { 
    
      var thisDoc = app.activeDocument;
            thisDoc.rulerOrigin = [0,0];
            thisDoc.pageOrigin = [0,0]; 
    
      var filename = app.activeDocument.name.replace(/\.[^\.]+$/, '');
      var createdate = app.activeDocument.modified; 
    
      var  theDate = new Date();
            var day = theDate.getDate();
            var month = theDate.getMonth() + 1;
            var year = theDate.getFullYear();
            var hours = theDate.getHours();
            var min = theDate.getMinutes();
                if (min < 10)
                    min = ("0" + min);
            var morn;
                if (hours >= 12)
                    {
                        hours = hours-12;
                        morn = " PM";
                    }
                else
                    morn = " AM" 
    
    var saveDate = (month + "-" + day + "-" + year + "    " + hours + ":" + min + morn ); 
    
      var nameTextFrame = thisDoc.textFrames.add();
        nameTextFrame.contents = globalartistname + "\n" + filename + "\n" + saveDate;
        nameTextFrame.top = 1000;
        nameTextFrame.left = 100;
        nameTextFrame.filled = true;
        nameTextFrame.alignment = "center"; 
    
        }//end put name 
    
    function savefile ()
    { 
    
        //change this folder location for the "savescript" variable to the one where the location of the save script is located on the server,
        //This save script is for the pallet that will pop up and list the different save options, not the individual save scripts themselves. 
    
            var savescript =  new File("S:/Art/ArtDept/Illustrator JS Palette/Scripts/Art Share Server/Save/Save Option Pallet");
                savescript.open("r");
          var bt = new BridgeTalk;
                bt.target = "illustrator";
          var script = savescript.read();
                savescript.close();
          bt.body = script;
          bt.send();   
    
          if (saved = true)
          {
              alert("File saved")
            } 
    
          if (saved == false)
          {
              alert ("File not saved")
              } 
    
          return true;
    }       
    
    //**********************************************************************************************************************************************************
    //********************This section is for the functions to check which button gets pressed and returns the text to a variable for output ****************
    //********************************************************************************************************************************************************** 
    
    //all radiobutton groups must be pressent in this array
    var totalgroups = [totes1] 
    
    //this function checks each group for the 1 radio button is clicked then returns its text
    function selected_rbutton (totalgroups)
    {//start function to check buttons
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Totes tab buttons 
    
    //when totes1 is pressed return text for output
    for (var i = 0; i < totes1.children.length; i++)
    {
    if (totes1.children[i].value == true)
    {
    return totes1.children[i].text;
    }//end if 
    
    }//end if
    }//end for 
    
    //////////////////////////////////////////////////////////////////////////open template 
    
    function openTemp()
    {
        //change the folder location of the templates here but leave the last section that is black, this will allow the script to open which
        //ever template they chose from the radiobuttons.  This location should be the same as the toteTempPath above but reduces the
        //chance for something to break by pulling the address here again instead of from the variable near the begining of the script. 
    
    var gettotetemp = new File("Z:/  Vitronic Master Templates/STE2 Templates/TOTES & BAGS/" + selected_rbutton (totalgroups));
    //var gettotetemp = new File("c:/temp/templates/" + selected_rbutton (totalgroups)); 
    
    var template = open(gettotetemp);  // get a reference to the template @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
      return template; // return the open template document @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    }//end open temp function 
    
    }//end if selection check 
    
    else
    {
        alert("Please select the artwork.");
      } // end else selection check
    
  • How can I get the sum of my variables and display the total?

    I wrote on a quiz and have each button by setting a variable, example: http://www.kreativitydesigns.com/Clients/Globus/Monograms/MBA_Test/deliverables/MBA_Quiz.h tml? mode = preview

    However, when it hits the frame of "Rank" to calculate and display the total, it does not appear.

    I do not have the text box named "Grade" on stage and variables have all received a value before entering this framework

    Here is the code used to calcualte and output the result:

    get the value of a variable and store

    var FinalScoreHolder is q1 + q2 + q3 + q4 + q5 + q6 + q7 + q8 + q9 + q10 + q11 + q12 + q13 + q14 + q15 + q16 + q17 + q18 + q19 + q20 + q21 + q22 + q23 + q24 + q25 + q26 + q27 + q28 + q29 + q30 + q31 + q32 + q33 + q34 + q35 + q36 + q37 + q38 + q40 + q39;.

    View rank

    SYM. $("Grade") .html ("you scored" + FinalScoreHolder + "%");

    See the result Page

    If (FinalScoreHolder > = 89) {}

    read the chronology of the given position (ms or label)

    SYM. Play ("Pass");

    } else {}

    read the chronology of the given position (ms or label)

    SYM. Play ("fail");

    }

    Any help would be greatly appreciated.

    Thank you!

    Your code is fine, but it seems that he can not do the values of your questions because if you put the values as below I get the expected result.

    Q1 = 20;

    Q2 = 63;

    Q3 = 12;

    get the value of a variable and store

    var FinalScoreHolder = q1 + q2 + q3;

    View rank

    SYM. $("grade") .html ("you scored" + FinalScoreHolder + "%");

    See the result Page

    If (FinalScoreHolder > = 89) {}

    read the chronology of the given position (ms or label)

    SYM. Play ("Pass");

    } else {}

    read the chronology of the given position (ms or label)

    SYM. Play ("fail");

    }

  • Tables and AS3 loadVars

    I have a text file with variables and a swf that a friend made for me. Unfortunately I do not have the .fla file and I'm trying to recreate it.

    the file contains 3 variables with values, repeated 4 times and a final variable (called varDone), who tells him there is no more variables.

    The three variables are varImage, varURL, varText. They are used to load the images that can be clicked to open a Web site and they have a textfield above them.

    The flash is a banner that we use on our site to display these images. Somehow, it reads the first set of variables in a movieclip that I believe, where the image then fades and remains on the screen for more than 3 seconds and then the next image. It maintains variable file playback until it hits that varDone = 1 variable, then the banner starts everywhere. The file is such that I can add as many sets of variables as I want and it will display all, it could be 3, 10 or 30, as long as I have added a new set of (varImage, varURL, varText) to the variable varDone of the file. I thought maybe he could load these 3 variables in an array to a two dimension and then their treatment like that. This is the part that I don't know how to do, how to read each set of variables, until I get to the varDone = 1. I can do all the other stuff, I don't know how to read this file.

    It looks like the following:

    & varImage = http://www.MOFC-gaming.com/themes/CT_RN_GREYSCALE/images/spotlight1.jpg
    & varHeadline = RECRUITMENT, BAD COMPANY 2 MEMBERS
    & varLink = http://badcompany2.EA.com/#/home

    & varImage = http://www.MOFC-gaming.com/themes/CT_RN_GREYSCALE/images/Spotlight2.jpg
    & varHeadline = join MOFC in EVE Online
    & varLink = http://www.eveonline.com

    & varDone = 1

    XML is what you want.  You will get a table 1 d (not 2D - 2D not necessary at all).  An XML like this would be enough:

    Text to display as the Image could go here.

    Text to display as the Image could go here.

    Text to display as the Image could go here.

    Then, in Flash, you load the xml file and the resulting XML object that you get can be parsed like this:

    _xmlObject.image;<-returns an="" xmllist="" of="" all="" 'image'="" nodes="" in="" the="" xml="">

    _xmlObject.image [0];<-returns the="" first="" xml="" object="" found="" in="" the="" xmllist="" described="" above. ="" when="" treated="" as="" a="" string="" it="" will="" output="" "text="" to="" display="" along="" with="" image="" could="" go="">

    _xmlObject.image.@URL[0]<- returns="" the="" string="">

    This will teach you everything you need to know: http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg1.htm

    I hope this helps.  For AS3, nothing but XML to load dynamic data.

  • Need help with TS to read the list of variables and/or LV

    Hello

    I use Labview adapter in Teststand to open WinIDEA and read the values of the variables. Basically LV lib files are used to read the value of the variable at run time, and returns the value of the variable. Contribution to this labview function i.e. variable name string and output type cluster.

    I need to read the list of variables and compare it to the value limits for each variable. I perhaps need to read at least 50 to 60 variables in one step if possible or a variable at a time in a loop. I want to add these variables in a txt file with the limits and read of Teststand as a string array and compare the result. In this way is easy to add or remove variables from the list and therefore their expected value. I tried to use the shipper of the property, but there need a stage name or local/global variable.

    Another way is to add the code in labview for comparison of variables value read, then I lose teststand power and flexibility.

    I am struggling to find the best way to achieve this. Any ideas?

    I would like it.  Basically, you have a file limit with 2 data tables.  A table contains your variables and the other your limits.  Then you wrap on a test of a string value.

    Let me know if you have any questions.

  • Variables and global imports

    Hi, I have; m using views on my new project and I was wondering if in actionscript I can do imports coming into the world to my entire application.

    For example.

    I have MyApplication.as that does it:

    import flash.data.SQLConnection;
    import views.Home;
    
    --
    private var home:Home;
    protected var dbConnection:SQLConnection = new SQLConnection;
    var dbFile:File = File.applicationDirectory.resolvePath("assets/mydb.db");
    dbConnection.open(dbFile);
    --
    
    home = new Home();
    addChild(home);
    

    The above code is obviously well separated in all methods and everything, but I just put online so you can see what I am trying to accomplish.

    On my home.as, I would then be able to use my connection (dbConnection) started the MyApplication.as, and I also want to import all the necessary libraries that will use throughout my application. For example. import flash.data.SQLStatement;

    I'm sure I'll have to use several times in different points of view, and if I import it every time, it gets a bit redundant.

    Could someone tell me how to make a variable and an overall import throughout the application? And 'global' the best way to do it?

    Thanks in advance,

    mplacona wrote:
    Could someone tell me how to make a variable and an overall import throughout the application? And 'global' the best way to do it?

    Furthermore, you essentially asked two unrelated things in your post, but you may not have realized given how you thought (possibly) imports worked.

    I addressed the issue of imports, while JRab gave you a way to deal with the other half of your question on access to variables in your application.

    In addition to using a singleton approach, you can count on the fact that your high class (what you call your "home.as", I guess) is instantiated in general only once in the application.  This makes it practically equivalent to a singleton.  (Singleton term is generally used for a class that you can't instantiate more of once, I think, but is probably too (put?-) used for a class that is instantiated only once, as with the main class.)

    If you want to set these variables in your main class, just make variable static.  This makes them directly accessible from any class that can 'see' your main class, which is usually everything within a single package.  Example follows:

    // in main class, e.g. Home.as
    
    public class Home extends Sprite {
        public static var version:String;
    
        // other vars here, maybe non-public or non-static
    
        public function Home() {
            Home.version = '1.2.3'; // store global reference
    
            // initialize app here
        }
    }
    
    ---------------------------
    
    // in some other module, e.g. Model.as
    public class Model {
    
        public function Model() {
            trace('version', Home.version);
        }
    
  • Despite his uniform and fixed on my form of task settings, I get thickness variable and facing interiors of the curves. I really wish it was just smooth and uniform. Any ideas?

    Despite his uniform and fixed on my form of task settings, I get thickness variable and facing interiors of the curves. I really wish it was just smooth and uniform. Any ideas?

    This question cannot be resolved when you use the brush with an effect.

    It cannot be solved with the form of the task.

    Try just drawing on larger scale, maybe then it won't happen.

  • PDF files: How can you save a file so that you can select and copy some text?

    I have some difficulty to save PDF files in photoshop.

    I saved a handful of PDF files, but I am only able to select and copy the text in some areas. These files have different areas that contain text. You are able to highlight a part of the text, but in other areas, you can not (even if they have the same font).

    The question is, which gives the text the ability to be selected and copied during registration as a PDF document?

    Including...

    Using BOLD, ITALICS or ALL uppercase in the settings of character disables the ability to highlight and copy the text once the file is saved in PDF format.

  • Hi, when I create a text box, and I type text in it, then I resize this text box, I want to see inside moving text at the same time I'm re-sizing of the text box. It does show me not LIVE what is happening inside the text box while I'm re-sizing text

    Hi, when I create a text box, and I type text in it, then I resize this text box, I want to see inside moving text at the same time I'm re-sizing of the text box. It does show me not LIVE what is happening inside the text box while I'm re-sizing of the text box and the same goes for the area of the image, I hope I could clarify my question.

    When resizing of a text box, click and hold for a moment before starting to resize. This will allow to see live redesign.

  • Text layer and image in text

    Dear community of PS elements!

    I have a burning question:

    How to create an image to appear in the text?

    Finally, I would like the poster to be in a color filled with just the image that appears in the text.

    I've already found a few useful tutorials like this one: http://graphicssoft.about.com/od/pselements/ss/imageintext_3.htm
    But the problem seems to be that program in my case does NOT create a text layer when I start working with text, as you can see in this picture (there is text but no LAYER?)Screen Shot 2014-07-08 at 4.23.05 PM.png

    I'm really a beginner - so sorry if this is something ridiculously obvious, but after a few hours of Googling for answers I really hope to find them here

    Thank you!

    Text layer and image in text

    You use the tool hides text, not the ordinary text tool. The type mask does not text; He makes a selection in the form of text. Try to create your text with the regular type tool (tool in the box change options tools), then reduce the opacity if you want solid text. If you mean you want to outline the text, then the beginning where you are now (with the selection in the form of text) and go in Edition > stroke (outline) selection and see if it's what you want.

  • Input record Input TextBox in variable, using in the text box on another frame

    Hello

    Have tried without success to save user input in an input text box, save in the variable and use this variable to fill in an area of dynamic text on another frame.

    First image:

    var a:String;
    var b:String;
    var c:String;
    aName1.addEventListener(Event.CHANGE, inputCapture1);
    function inputCapture1(e:Event):void{
    a = aName1.text;
    }
    bName1.addEventListener(Event.CHANGE, inputCapture2);
    function inputCapture2(e:Event):void{
    b = bName1.text;
    }
    cName1.addEventListener(Event.CHANGE, inputCapture3);
    function inputCapture3(e:Event):void{
    c = cName1.text;
    }
    
    

    Then on another frame (later)

    dynamictextbox1. Text = a;

    And so on, on the other images.

    So far crushed the overview of debugging. If I take the script on the first image and setting later, not crash.

    Any help appreciated.

    You must have the layer with the code above, extended until the frame later so that these variables are available here.

Maybe you are looking for

  • Pavilion dv6-7000sy backlit keyboard support?

    Hi, I was wondering if my pavilion dv6-7000sy support backlit keyboard? If so, how to find good replacement?

  • Basic Newbie Question Timeout

    Hi, I wrote a Subvi, which sends a command (gpib write) to a physical instrument. Occasionally, that it is blocked to the gpib write VI. I want to this Subvi program such that the failure of this sub - VI will not result in the failure of the entire

  • Update error - SQL Server 2008 SP1

    Hello I am using Windows 7 Ultimate 64 bit I installed VS2010 Trail, then I installed SQL Server Express Studio My Windows shows update there is a update for SQl Server 2008 Service Pack 1 But when I try to install this update I get an error like bel

  • damaged or unreadable file

    My problem with these files unreadable or corrupt, it's that they are connected somehow to my iTunes application. He's been close a months ago that my problem with iTunes started. The app will not retain the library on the app between sign - on. I di

  • No more on-screen Ko after update 8.1 on DUO 13.3

    After update 8.1, the operating system doesn't seem to know present one on-screen Ko when I tap on a field such as the field of password when entering Windows. Yes, the part of the touchscreen works perfectly well. Please do not confuse this problem