Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

+ Reply to Thread
Results 1 to 2 of 2
  1. #1

    Default Renaming Selected Library.

    Hi,
    I am a Python programmer(Maya),very new to flash,Friend asked one script from flash,Which renames selected items from Library.I googled it and i found some info.This is the script(After small changes).

    Code:
    var addText;
    myButton.addEventListener(MouseEvent.CLICK, clickButtonHandler);
    var selectedItems = fl.getDocumentDOM().library.getSelectedItems();
    
    function clickButtonHandler(e:MouseEvent)
    {
        if (selectedItems.length == 0)
        {
            alert("Please select 1 or more symbols in the library.");
        } else if (selectedItems.length >= 1)
        {
            addText = myText.text;
            changeLibraryNames();
        }
    }
    
    function changeLibraryNames()
    {
        var i;
        if (addText == null)
        {
    
        } else
        {
            for (i = 0; i < selectedItems.length; i++)
            {
                selectedItems[i].name = selectedItems[i].name + addText;
            }
        }
    }
    If i run this from script editor.I am getting errors like "Access to undefined property fl" and "undefined method alert".

    I think i need to include some headerfile stuff ???

    Please explain me some detailed way(Bcoz i am very new to flash-First time i am using flash).

    Thanks.
    Last edited by Vlykarye; 07-22-2011 at 03:27 PM.

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    485

    Default

    fl is a Flash library.
    You cannot access Flash's libraries this way.
    Furthermore, it would be pretty hard to explain to you all the ways to use predefined objects and functions in Flash.
    I suggest that you read some of the help docs on Adobe's site.
    It will take a while to find what you're looking for, but it would be the best way.

    Also. "alert" is undefined because you didn't define it. There is not predefined function called "alert". The closest function I can think of "trace()".
    Good luck.

    Also also. There are no headers in flash, and I'm pretty sure there aren't any compiler directives.
    Last edited by Vlykarye; 07-22-2011 at 03:33 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial