Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

[JSFL] Having a linkage classname according to the movie clip name

Community Beginner ,
Dec 15, 2015 Dec 15, 2015

Hello,

I have some issue doing this. As I'll be doing this for some times, I wanted to try a jsfl script instead of doing this manually each time.

My library will look like this every time.

2015-12-15_11-30-42.jpg

What I would like to have in the end:

2015-12-15_16-31-01.jpg

What I want is simple, I just want to take the name of each movie clip and paste it into the linkage attribute.

So getting the name was pretty easy, but as it was the full path, I needed to cut it, so I used substring.

But then, despite my several attempts, I can't manage to paste the name into the linkage attribute.

It doesn't want to take my last sentence: "fl.getDocumentDOM().library.items.className = newClassName;"

Any ideas?

Here is the code:

function init()

{

        fl.outputPanel.clear();

        var i = fl.getDocumentDOM().library.items.length;

        var lib = fl.getDocumentDOM().library;

        while(i--)

        {

                if(fl.getDocumentDOM().library.items.itemType=="movie clip")

                    {

                        var getName = fl.getDocumentDOM().library.items.name;

                        newClassName = getName.substring (20, getName.length);

                        fl.trace(newClassName);

                        fl.getDocumentDOM().library.items.className = newClassName;

                    }

                }

        }

init();

TOPICS
Exchange extensions
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Feb 09, 2016 Feb 09, 2016

Finally got my code working with some more lines.

Well, I just needed to add "item.linkageExportForAS=true;". Of course...

function init()

{

        var i = fl.getDocumentDOM().library.items.length;

        var lib = fl.getDocumentDOM().library;

        while(i--)

        {

            var item = lib.items;

            if(lib.items.itemType=="movie clip")

            {

                if(item.linkageExportForAS==false)

                {

                    var getName = lib.items.name;

          

...
Translate
Community Beginner ,
Jan 07, 2016 Jan 07, 2016

Well, nobody has a sligth idea?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 09, 2016 Feb 09, 2016
LATEST

Finally got my code working with some more lines.

Well, I just needed to add "item.linkageExportForAS=true;". Of course...

function init()

{

        var i = fl.getDocumentDOM().library.items.length;

        var lib = fl.getDocumentDOM().library;

        while(i--)

        {

            var item = lib.items;

            if(lib.items.itemType=="movie clip")

            {

                if(item.linkageExportForAS==false)

                {

                    var getName = lib.items.name;

                    newClassName = getName.substring (20, getName.length);    

                    item.linkageExportForAS=true;

                    item.linkageClassName=newClassName;                  

                }

            }

        }

}

init();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines