The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Flash
  • ActionScript
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Flash
 ActionScript

  • Isocase Author 
    • 2322 
    • 0 
    • 1 
    [JSFL] Organizing library items
    Anik

    Last reply Aug 08 2008, 04:46 PM

    by Anik

    Posted: Aug 08 2008, 04:40 PM

    by Isocase

     

A long time ago Nutrox posted a thread with details on he organizes his library items in Flash, which I set mine up similarly. I couldn’t find the thread so I have to start a new one. Here is a jsfl script that I wrote that will create a folder structure:

lib
——clips
——bitmaps
——fonts
——media

Anytime you run the script it will put all your items in the correct folder. I didn’t create a folder for “buttons” because I don’t use them and prefer to use mc’s. Also when you import a png, Flash creates a graphic symbol for the image. When you run the script it will delete that symbol since I haven’t come across a time when it was needed. This is my first time working with jsfl so if my code is a bit sloppy please let me know how to optimize. I did run tests and it works fine and it does work correctly.

var dom = fl.getDocumentDOM();

if( 
dom == null || dom == undefined )
{
    alert
( "Document Object is null and cannot be accessed" );
}
else
{
    createLibrary
();
    
cleanLibrary();
}

function createLibrary()
{
    dom
.library.newFolder( "lib/bitmaps" );
    
dom.library.newFolder( "lib/clips" );
    
dom.library.newFolder( "lib/fonts" );
    
dom.library.newFolder( "lib/media" );
}

function cleanLibrary()
{
    
var libraryItems = dom.library.items;
    
    var 
i = libraryItems.length;
    
    while( 
i -- )
    
{            
        
if( libraryItems[ i ].itemType == "movie clip" )
        
{
            dom
.library.moveToFolder( "lib/clips", libraryItems[ i ].name, true );
        
}
        
else if( libraryItems[ i ].itemType == "bitmap"  )
        
{
            dom
.library.moveToFolder( "lib/bitmaps", libraryItems[ i ].name, true );
        
}
        
else if( libraryItems[ i ].itemType == "font" )
        
{
            dom
.library.moveToFolder( "lib/fonts", libraryItems[ i ].name, true );
        
}
        
else if( libraryItems[ i ].itemType == "sound" || libraryItems[ i ].itemType == "video" )
        
{
            dom
.library.moveToFolder( "lib/media", libraryItems[ i ].name, true );
        
}
        
else if( libraryItems[ i ].itemType == "graphic" )
        
{
            dom
.library.deleteItem( libraryItems[ i ].name );
        
}
    }
} 
  1 REPLY
 
Anik
1  
Anik

thanks for sharing isocase, ill test it later and let you know how it goes.

  • 08 August 2008 04:46 PM
  •  
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 775  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,724  Assets
  • Profiles 282,659  Members
  • Topics 93,762  Topics
  • Blog 4  Blog
  • Facebook 1,680  Facebook
  • Twitter 1,165  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 04, 2012 - 20:22:21