Actionscript 3 :: Passing A Font From One Class To Another?
Sep 16, 2010
I loaded a font.swf (in Flash CS5) and it works in the class I loaded the font into, but if I want to pass it to another class, how do I do that? I tried passing it as a TextFormat instance (with the format.font = my_loaded_font) but that doesn't appear to work...
View 2 Replies
Similar Posts:
Oct 12, 2010
i have a movie clip which is exported for ActionScript , i want to get a variable from the document class into the movie clip class i tried this but there was an error !!
ActionScript Code:
var main:Main=new Main();
main.txtScore.text="hello";
View 1 Replies
Mar 1, 2011
I created a movieclip with a star. Then, I creates a document class and I named it as Main.as.
In that document class I wrote:
package
{
import flash.display.*;
public class Main extends MovieClip
[Code]....
I´m not posting here all the code, but you can easily see that I´m using x_origin and y_origin variables to keep the original position of the movie clip. I will use them to move the star back to the original position.
The problem is that instead of being 20 and 30 respectively, tracing them I see that they are both ZERO. So when I drop the star, instead of going to x=20,y=30 it moves back to x=0 and y=0. I´ve to get the star position relative to stage, but I can´t find anyway!
View 4 Replies
Dec 28, 2009
I'm trying to create a class which will create a tween for several different instances of an object. I am creating the instances in the Document Class. The trick is, I would like to specify how long each tween will take.
Here's what I have so far:
DOCUMENT CLASS
ActionScript Code:
package {
import flash.display.MovieClip;
import mcCloud;
[Code].....
As you can see, I have a variable "myTime" which syncs the timer and the tween. This causes to tween to repeat and the clouds to continually scroll across the stage. How can I determine the var myTime at the time I create each instance of the Movie Clip mcCloud?
View 6 Replies
Aug 6, 2009
I've got a document class (EgoGame.as) and another class (Ball.as) which has been duplicated to deal with several different video pieces. Inside the document class is a list of 'if' statements which decide which video should be played. At the moment I'm doing it the old fashioned way whereby if the condition is true....it tells the relevant Ball class to gotoAndPlay a certain frame within the linked movieclip...
[Code]...
View 1 Replies
Feb 7, 2011
I'm trying to embed a font in my project by using url("font.ttf") rather than local("Font Name"), but it doesn't seem to pick it up. The font in question is called "Gotham Bold". When i view the details of the font, the font weight is regular, however when i use local("Gotham Bold") in the css i have to specify fontWeight: bold or else it wont pick it up. But when I use url("folderGotham-Bold.ttf"), and specify fontWeight: bold, it says that font weight is not found for that TTF. If i remove the fontweight, there's no errors, but the font is not applied to the text.
View 2 Replies
Apr 28, 2011
I added a font Arial to the library. In properties for the font the Class box is greyed out. Do I need to add the font class in the code?Also I have a dynamic text box on the stage. Which anti-alias setting do I use and can / should it be selectable? I also selected character embedding and selected ALL for Arial Narrow Bold.
The text is not showing up arial narrow bold
var mainText = new TextFormat();mainText.font = "Arial Narrow"; mainText.size = 18;mainText.color = 0x333333;mainText.bold = true;
View 1 Replies
Aug 12, 2009
If you import fonts as symbols into the Library in Flash's IDE, are those font symbols available only to the document class, or can they be used by other classes? Do those other classes need to be passed a reference to it? Question Two: This seems to be standard way to embed fonts into a class:
[Code]...
Often embeding fonts using the above method doesn't work. I've done lots and lots (and lots!!) of testing and the transcoder is very picky about which fonts it finds acceptable. It really likes .otf fonts but often not .ttf I found out that there are 3 different font managers used to transcode fonts, and although the correct one is supposed to be selected automatically, this doesn't always happen.
[URL] The solution to this in Flex is to add this additional compiler argument: -managers=flash.fonts.AFEFontManager My question is, does anyone out there know how to force the AFEF font manager in the Flash IDE?
View 2 Replies
Mar 30, 2011
When creating an mxml component it is easy to embed the desired font in this way:
@font-face {
src: local("Arial");
fontFamily: ArialEmbedded;
}
In my code I need to embed the font for a component that is the part of the class implemented in *.as file. How can I do this?
View 2 Replies
Jul 15, 2009
How do I give a class name to an embedded font when embedding using the textfield properties panel?
View 1 Replies
Nov 14, 2009
With reference to the subject, I am using the following statement to embed the font within my custom class:
Code:
[Embed(systemFont = "Verdana",
fontName = "VerdanaReg",
[code]......
View 10 Replies
Jan 20, 2010
I'm trying to embed in my class file and I'm following these instruction But have the flowing error message:VerifyError: Error #1014: Class mx.core::FontAsset could not be found.ReferenceError: Error #1065: Variable FontClass_theClass is not defined.ReferenceError: Error #1065: Variable MainTimeline is not defined.
View 6 Replies
Jul 24, 2010
I have a class that works with an external swf with play, pause and slider. Now that I have all that working, I'd like to be able to pass the URL of the external SWF to the class from the main fla AS. I managed to use a 'set' inside the class to retrieve the name, but it apparently doesn't trigger until after the external SWF gets loaded.
Code snippets follow:
CntlClass:
public var loader:Loader;
private var _urlName:String;
public function CntlClass() {
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, movieLoaded);
loader.load(new URLRequest(_urlName));
public function set urlName(value:String):void {
_urlName = value;
}
Main FLA file - other than a controller (cntl_mc) containing a play button, a pause button, and a slider, the only thing in the FLA file is this code in the first frame:
cntl_mc.urlName = "extswf.swf";
View 5 Replies
Oct 24, 2009
I am making a game project using tiles. I want to ask bout the xml.
I know how to load an xml data into the stage by using one class from library
However, rite now, I have 3 customer_mc with class for each: char1,char2,char3
And i have this xml data called customer_xml that contents the customer name,order and payment. So far i know how to call one class and do a for loop but i cant find a way to call three classes and put it into the for loop.
function init(xmlString:String):void {
customer_xml = new XML(xmlString);
for (var i:uint = 0; i<customer_xml.customer.length(); i++) {
var customer_mc:char1= new char1();
[Code].....
how can i put three customer mc into the for loop? Do I put it in an array?
Second, I don't want it to be put randomly on the stage but only on the right corner of the stage. Is that mean, I put a precise coordinate for the customers mc?
View 0 Replies
Nov 23, 2009
I have those 2 function inside a class named MenuScreen.as, What I want to do is send a value true or false to another class named Game.as.If the user clicked mouse icon the value must be true and if user clicked keyboard icon it must be false.[code]
View 11 Replies
Jun 16, 2011
I have a custom class being constructed from my main class. In the custom class it has another custom class that is passed in as a parameter. I would like to strictly type the parameter variable but when I do, 'the type is not a compile type constant etc'.This, I understand, is because the custom class used as a parameter has not yet been constructed.It all works when I use the variable type ( * ) to type the parameter.I suspect this is a design flaw, in that I am using an incorrect design pattern.It is actually hand-me-down code, having received a large project from someone else who is not entirely familiar with oop concepts and design patterns.
I have considered using a dummy constructor for the parametered class in my main class but the passed in class also takes a custom class (itself with a parametered constructor). I am considering using ... (rest) so that the custom classes' parameters are optional.Is there any other way to control the order of construction of classes? Would the rest variables work?edit)in main.as within the constructor or another function
var parameter1:customclass2;
customclass1(parameter1);
in customclass1 constructor:
[code].....
View 1 Replies
Apr 28, 2009
So I've created a custom class which makes use of a Sound object. The Sound object loads a sound from a URL, and I attach and event listener to it to see it when it finishes loading i.e. Event.Complete
MY question is this: how do I receive this event outside of the class? For instance, I want to be able to create an instance of my class somewhere else, load a sound and attach an event listener to my custom class that listens for the event thrown by the sound. Understandably, I don't want to make the sound object a public variable.
View 3 Replies
Nov 12, 2009
if i have multiple movieclips on the stage and i am writing a document class and in document class i import another class and i need to pass these movieclips to that class.
View 1 Replies
Feb 8, 2011
Passing Values From One Class To Another.
This this not seems a difficult tusk to understand.
I can able to connect classes to each other. But the thing is that, when I am going to construct some logic to load and hold xml data and only fetch the correct child object from it, I stumped.
Here is the starter:
I connect loadXML.as to Main.fla from Properties Panel.
loadXML.as
ActionScript Code:
package {
import flash.display.Sprite;
[Code].....
View 5 Replies
Feb 21, 2009
I have been trying to put the As3 video tutorial into a class which works fine if I keep the url of the file to play within the class. But I want to be able pass the url from the actual swf file... I have had limited success.
Here is the Document Class
Code: Select allpackage
{
import flash.display.MovieClip;
import flash.events.*;
[code]....
And in the swf I have this
Code: Select allvar v_url:VideoClass = new VideoClass("test.flv");
View 3 Replies
Aug 30, 2007
well, i'm getting into flash classes, and i'm working on my first project using self written classes. but i got a question about variables.i've got a MC rad_container with the class Rad linked to it. By using class instances i can now send the variable from the MC to the class, and get it returned.but i want to use the same varhere's my class Rad
Code:
class Rad extends MovieClip {
public var ballKleur:String;
[code]....
View 4 Replies
Aug 19, 2009
I am calling java servlets from flash using the following code[below is a sample Flash code for calling a java servlet in Flash which I am using]:
...bla ...bla
String url_String="http://localhost:8080/servlet/getViews";
var req:URLRequest = new URLRequest(url_String);
[code].....
View 6 Replies
Sep 16, 2009
I have the following class
Code:
package {
import flash.display.Stage;
[code]....
Which is not a document class. I wish to pass the stage of the main timeline into the class, say on frame 1
Code:
stop();
var c:CustomObject = new CustomObject(this.stage);
Is this the right way of passing the stage of the main timeline into another class?
View 1 Replies
Jan 12, 2010
I'm trying to pass a string from the main timeline into a variable within a class (public _myVar:String how i can acces the public variable within my class and populate it?
View 10 Replies
Mar 6, 2010
In my document class "Engine" I need to make my "Game Handler" class which is done in the constructor by using:
Code:
var Game:GameHandler = new GameHandler(stage);
As you can see, im passing the stage into it.. now in my GameHandler class
[code].....
View 5 Replies
Apr 4, 2010
I have my FLA with a Document Class. I also have one other class, that doesn't extend anything. am trying to pass the stage from the FLA on to my non-Document class. Obviously, the Document Class can see the main stage no problem, but having trouble passing that stage to an external class.I tried to pass it from Frame 1 in my FLA. I also tried to pass it from my Document Class to my external class, but not working like it should.Code:var passStage:TitleClass = new TitleClass(stage)Now, on to my TitleClass (non-Document class / external class)
Code:
package {
import flash.display.*;
[code].....
View 3 Replies
Jan 26, 2011
I have created a custom class. It seems to work (at least no errors), but when I create a button in the actual FLA that calls on the class, it doesn't change what I want it to change. Here is the class:
[Code]...
When I call for the class to make the button, it works. It also successfull calls the default.png from the class, but in the FLA the icon_retrofit.myIcon doesn't change the image to 'images/b.png'.
View 2 Replies
Apr 3, 2011
how to pass the value of a variable in class1 to class2?
View 1 Replies
Jun 12, 2009
I am trying to pass an xmlList from this class, and am having some issues. The thing is, how can I call a method that listens for a result, then calls another method..
package com.ryancanulla.utils
{
import mx.rpc.events.ResultEvent;
[code].....
View 3 Replies
Sep 24, 2009
I am working with a simple MVC pattern.
But in my model i try to do this:
Main(root).Message(" model done!");
But i cant pass in the root, couse the model classes are Eventdispatchers and no sprirtes.
View 1 Replies