When embedding fonts do not name fontName or fontFamily the filename or the text will not appear if you set TextField::embedFonts to true. The filename is probably the device font name which can only be used if TextField::embedFonts is false.
All variations produce the same results:
[Embed(source="C:/WINDOWS/fonts/ARIAL.TTF", fontFamily="Arial")]
[Embed(source="C:/WINDOWS/fonts/ARIAL.TTF", fontName="Arial")]
[Embed(source="C:/WINDOWS/fonts/ARIAL.TTF", fontFamily="Arial", mimeType="application/x-font-truetype")]
[Embed(source="C:/WINDOWS/fonts/ARIAL.TTF", fontName="Arial", mimeType="application/x-font-truetype")]
TextField::text
TextField::htmlText
Test:
[Embed(source="../assets/ARIAL.TTF", fontName="Arial")]
private const EMBED_ARIAL:Class;
var tf:TextField = new TextField();
var format:TextFormat = new TextFormat("Arial");
addChild(tf);
tf.embedFonts = true;
tf.defaultTextFormat = format;
tf.text = "Test";
OR
tf.embedFonts = true;
tf.text = "Test";
tf.setTextFormat(format);
You will see no text.
Thursday, August 14, 2008
Fonts Bug
TextField::defaultTextFormat does not work with TextField::htmlText
var tf:TextrField = new TextField();
var format:TextFormat = new TextFormat("Arial");
addChild(tf);
Does not work:
tf.embedFonts = true;
tf.defaultTextFormat = format;
tf.htmlText = "Test";
Works:
tf.embedFonts = true;
tf.defaultTextFormat = format;
tf.text = "Test";
For TextField::htmlText use :
tf.setTextFormat(format);
var tf:TextrField = new TextField();
var format:TextFormat = new TextFormat("Arial");
addChild(tf);
Does not work:
tf.embedFonts = true;
tf.defaultTextFormat = format;
tf.htmlText = "Test";
Works:
tf.embedFonts = true;
tf.defaultTextFormat = format;
tf.text = "Test";
For TextField::htmlText use :
tf.setTextFormat(format);
Thursday, August 7, 2008
Command Line Debugger Shortcut
After you type "run" in the "(fdb)" command prompt and executed the SWF file to debug, the debugger will load the SWF code. Typing "info sources" or "info file" will bring a list of source files loaded. See the "#' on filename.as#1, well that is a shortcut to the file. Another way to find files and their number shortcut is to:
(fdb) list a
Will bring up all functions that begin with the letter "a" and what file they are in and yes it is case sensitive.
To set a break point simply type:
(fdb) break #19:315
The 315 being the line number you want to break at.
Not sure want line to break at?
List the file like so:
(fdb) list #19
This will list the first 10 lines of code. Repeatedly hitting enter executes the last command without the passed in argument, so it will list the next 10 lines and so on. To skip to a certain location try:
(fdb) list #19:75
Which will jump to the 75th line of code.
Type "continue" to run your SWF. Check out the other options be typing "help" on the "(fdb)" prompt.
Another shortcut that can be used is just typing the first few letters of the command and not the whole command. For example "c" for "continue", "r" for "run", and "b" for "break". "help" displays the shortcuts next to the command in parentheses.
Enjoy!
(fdb) list a
Will bring up all functions that begin with the letter "a" and what file they are in and yes it is case sensitive.
To set a break point simply type:
(fdb) break #19:315
The 315 being the line number you want to break at.
Not sure want line to break at?
List the file like so:
(fdb) list #19
This will list the first 10 lines of code. Repeatedly hitting enter executes the last command without the passed in argument, so it will list the next 10 lines and so on. To skip to a certain location try:
(fdb) list #19:75
Which will jump to the 75th line of code.
Type "continue" to run your SWF. Check out the other options be typing "help" on the "(fdb)" prompt.
Another shortcut that can be used is just typing the first few letters of the command and not the whole command. For example "c" for "continue", "r" for "run", and "b" for "break". "help" displays the shortcuts next to the command in parentheses.
Enjoy!
Saturday, August 2, 2008
The Wheel
Always try to search for existing code, components, and libraries before venturing out to developer land.
Components
MinimalComps
Great for prototyping.
Yahoo! Astra
They actually have a lot of useful information.
Libraries
AS3CoreLib
Documentation
Contains a lot of useful functionality.
AS3Crypto
All crypto, all the time!
Alternative Crypto
labs.boulevart.be (A variety of encryption)
gsolofp.blogspot.com (MD5 and SHA1)
Occasionally Updated...
Components
MinimalComps
Great for prototyping.
Yahoo! Astra
They actually have a lot of useful information.
Libraries
AS3CoreLib
Documentation
Contains a lot of useful functionality.
AS3Crypto
All crypto, all the time!
Alternative Crypto
labs.boulevart.be (A variety of encryption)
gsolofp.blogspot.com (MD5 and SHA1)
Occasionally Updated...
Thursday, July 31, 2008
Using Components in Flash Develop
To use Flash IDE components in Flash Develop:
It does not matter which component you choose, it will all be added to the created SWC. Now just make sure to add it for inclusion when you build your code, which ever way you do it.
To double check if the components are there just open the SWC file with a zip program and you should see a list of SWFs and catalog.xml file.
- Create a new 'Flash File'
- Double click on the components you want to use. (Ctrl + F7 to bring up the 'Components' window)
- Select a component in the 'Library' window and select 'Export to SWC...'
- Decide on a file name and save it
It does not matter which component you choose, it will all be added to the created SWC. Now just make sure to add it for inclusion when you build your code, which ever way you do it.
To double check if the components are there just open the SWC file with a zip program and you should see a list of SWFs and catalog.xml file.
Installing Flex 3 and Ant
Ant install:
Unzip "apache-ant-1.7.1-bin.zip"
into "C:\Program Files\"
Flex 3 SDK install:
Unzip "flex_sdk_3.zip" into "C:\Program Files\flex_sdk_3"
Copy the "C:\Program Files\flex_sdk_3\ant\lib\flexTasks.jar" into
"C:\Program Files\apache-ant-1.7.1\lib\"
Access the environment variables:
(Windows Key + Pause)
Go to the "Advance" tab then the "Environment Variables" button.
Create Environment Variables:
Create new variables called:
ANT_HOME
FLEX_HOME
With values of, respectively:
C:\Program Files\apache-ant-1.7.1
C:\Program Files\flex_sdk_3
Add to your path:
%ANT_HOME%\bin;%FLEX_HOME%\bin
Setup Flash Develop:
We have to tell Flash Develop where to look for the compiler.
Either hit F10 or traverse to Tools::Program Settings...
Select "AS3Context" on the left pane under "Plugins".
Under "Language" in the right pane, select and modify "Flex SDK Location".
For the purpose of this post it is "C:\Program Files\flex_sdk_3".
Under Project::Properties...
Select the "Output" tab.
Check the check box of "No output, only run pre/post build commands."
Select the "Build" tab.
Under the "Pre-Build Command Line" section add "ant.bat".
This is why we need the ANT_PATH variable.
Apply the changes.
When working on a project you ideally would have a "build.xml"
file in the root of your project. To build the project hit F8. This
will produce whatever the build file was told to do.
The FLEX_PATH allows ant to access mxmlc and compc executables.
Flex Tasks allows us to add compiler options as xml nodes. More on that here.
Unzip "apache-ant-1.7.1-bin.zip"
into "C:\Program Files\"
Flex 3 SDK install:
Unzip "flex_sdk_3.zip" into "C:\Program Files\flex_sdk_3"
Copy the "C:\Program Files\flex_sdk_3\ant\lib\flexTasks.jar" into
"C:\Program Files\apache-ant-1.7.1\lib\"
Access the environment variables:
(Windows Key + Pause)
Go to the "Advance" tab then the "Environment Variables" button.
Create Environment Variables:
Create new variables called:
ANT_HOME
FLEX_HOME
With values of, respectively:
C:\Program Files\apache-ant-1.7.1
C:\Program Files\flex_sdk_3
Add to your path:
%ANT_HOME%\bin;%FLEX_HOME%\bin
Setup Flash Develop:
We have to tell Flash Develop where to look for the compiler.
Either hit F10 or traverse to Tools::Program Settings...
Select "AS3Context" on the left pane under "Plugins".
Under "Language" in the right pane, select and modify "Flex SDK Location".
For the purpose of this post it is "C:\Program Files\flex_sdk_3".
Under Project::Properties...
Select the "Output" tab.
Check the check box of "No output, only run pre/post build commands."
Select the "Build" tab.
Under the "Pre-Build Command Line" section add "ant.bat".
This is why we need the ANT_PATH variable.
Apply the changes.
When working on a project you ideally would have a "build.xml"
file in the root of your project. To build the project hit F8. This
will produce whatever the build file was told to do.
The FLEX_PATH allows ant to access mxmlc and compc executables.
Flex Tasks allows us to add compiler options as xml nodes. More on that here.
Wednesday, July 16, 2008
Command Line Compiler and Debugger
Open a command prompt here:
C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\ActionScript 3.0
Compiler
java -jar asc_authoring.jar -help
Debugger:
java -jar fdb.jar
Which will get you this:
(fdb)
Then type "help" or "tutorial".
Enjoy!
More later.
C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\ActionScript 3.0
Compiler
java -jar asc_authoring.jar -help
Debugger:
java -jar fdb.jar
Which will get you this:
(fdb)
Then type "help" or "tutorial".
Enjoy!
More later.
Subscribe to:
Posts (Atom)