Current location: Hot Scripts Forums » General Web Coding » Flash & ActionScript » Actionscript Import Question


Actionscript Import Question

Reply
  #1 (permalink)  
Old 02-22-10, 01:24 AM
agiles2303 agiles2303 is offline
New Member
 
Join Date: Feb 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Actionscript Import Question

I have absolutely no ActionScript Experience, but I have a very specific question. I have found a font picker that uses actionscript and flash. Instead of it importing all of the fonts on the user system, how can I get it to import the fonts from a specific folder on the web server?

I have attached the Main.as file below as an archived file.

Again I need the coding to pull fonts from a specific folder on the web server instead of the current setup.

If you want the entire package instead of just the .as file, this is the download link for the entire package.

http://flashtuts.s3.cdn.plus.org/043...iew/source.zip

Appreciate the help!
Attached Files
File Type: zip Main.zip (1.2 KB, 18 views)
Reply With Quote
  #2 (permalink)  
Old 02-22-10, 05:39 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
It makes it easier for people to help you if you post the code directly (not in a .zip file)
Reply With Quote
  #3 (permalink)  
Old 02-22-10, 09:49 AM
agiles2303 agiles2303 is offline
New Member
 
Join Date: Feb 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by agiles2303 View Post
I have absolutely no ActionScript Experience, but I have a very specific question. I have found a font picker that uses actionscript and flash. Instead of it importing all of the fonts on the user system, how can I get it to import the fonts from a specific folder on the web server?

I have attached the Main.as file below as an archived file.

Again I need the coding to pull fonts from a specific folder on the web server instead of the current setup.

If you want the entire package instead of just the .as file, this is the download link for the entire package.

http://flashtuts.s3.cdn.plus.org/043...iew/source.zip

Appreciate the help!
Quote:
Originally Posted by wirehopper View Post
It makes it easier for people to help you if you post the code directly (not in a .zip file)

PHP Code:

/* Flash Font Picker */

/* Developed By Carlos Yanez */
/* Installed fonts viewer */

package 
{
    
/* Import required Classes */
    
    
import flash.display.Sprite;
    
import flash.text.TextFormat;
    
import fl.transitions.Tween;
    
import fl.transitions.easing.Elastic;
    
import flash.text.Font;
    
import fl.data.DataProvider;
    
import flash.events.MouseEvent;
    
import flash.events.Event;
    
import fl.events.ListEvent;
    
import fl.events.ColorPickerEvent;
    
import flash.geom.ColorTransform;

    public class 
Main extends Sprite
    
{
        
/* Variables */

        
private var systemFonts:Array = new Array();
        private var 
fontNames:Array = new Array();
        private var 
fmt:TextFormat = new TextFormat();
        private var 
tween:Tween;

        public function 
Main()
        {
            
showColorPicker(false);
            
loadFonts();
            
addListeners();
        }
        
        
/* Show or hide color picker (Text and Components) */
        
        
private function showColorPicker(val:Boolean):void
        
{
            
bgColorText.visible val;
            
fontColorText.visible val;
            
bgColorPicker.visible val;
            
fontColorPicker.visible val;
        }

        
/* Load local fonts */

        
private function loadFonts():void
        
{
            
systemFonts Font.enumerateFonts(true);
            
systemFonts.sortOn("fontName");

            
/* Convert the Fonts Objects to Strings */

            
for (var i:int 0systemFonts.lengthi++)
            {
                
fontNames.push(systemFonts[i].fontName);
            }

            
/* Set List data */

            
fontsMenu.fontsList.dataProvider = new DataProvider(fontNames);
        }

        
/* Info button actions */

        
private function showFonts(e:MouseEvent):void
        
{
            
tween = new Tween(fontsMenu,"x",Elastic.easeOut, -  fontsMenu.width,stage.stageWidth 2,1,true);
            
tween = new Tween(txt,"y",Elastic.easeOut,txt.y,txt.85,1,true);
            
e.target.visible false;
            
            
showColorPicker(true);
        }

        
/* Choose actions */

        
private function onChange(e:Event):void
        
{
            
fmt.font = new String(e.target.selectedItem.data);
            
txt.setTextFormat(fmt);
        }

        private function 
choosed(e:ListEvent):void
        
{
            
infoButton.visible true;

            
tween = new Tween(fontsMenu,"x",Elastic.easeOut,stage.stageWidth 2,stage.stageWidth fontsMenu.width,2,true);
            
tween = new Tween(txt,"y",Elastic.easeOut,txt.y,txt.85,1,true);

            
showColorPicker(false);
        }
        
        
/* Cancel function */

        
private function cancel(e:MouseEvent):void
        
{
            
infoButton.visible true;

            
tween = new Tween(fontsMenu,"x",Elastic.easeOut,stage.stageWidth 2,stage.stageWidth fontsMenu.width,2,true);
            
tween = new Tween(txt,"y",Elastic.easeOut,txt.y,txt.85,1,true);

            
showColorPicker(false);
        }

        
/* Handle color picker */

        
private function changeFontColor(e:ColorPickerEvent):void
        
{
            
fmt.color "0x" fontColorPicker.hexValue;
            
txt.setTextFormat(fmt);
        }

        private function 
changeBgColor(e:ColorPickerEvent):void
        
{
            var 
colorTransform:ColorTransform = new ColorTransform();
            
colorTransform.color int("0x" bgColorPicker.hexValue);
            
bg.transform.colorTransform colorTransform;
        }

        private function 
addListeners():void
        
{
            
infoButton.addEventListener(MouseEvent.MOUSE_UPshowFonts);
            
fontsMenu.fontsList.addEventListener(Event.CHANGEonChange);
            
fontsMenu.fontsList.addEventListener(ListEvent.ITEM_DOUBLE_CLICKchoosed);
            
fontColorPicker.addEventListener(ColorPickerEvent.CHANGEchangeFontColor);
            
bgColorPicker.addEventListener(ColorPickerEvent.CHANGEchangeBgColor);
            
fontsMenu.closeBtn.addEventListener(MouseEvent.MOUSE_UPcancel);
        }
    }

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NullPointerException when asking for InternalFrameUI UnrealEd Everything Java 2 08-04-07 12:35 PM
title bar is not showing up in JInternalFrame UnrealEd Everything Java 7 04-25-07 03:33 AM
Injecting a string into an If Statement ? nova912 PHP 4 07-21-06 02:04 PM
question and answer software jaydifox C/C++ 0 02-21-04 09:26 AM


All times are GMT -5. The time now is 06:51 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.