Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Flex > New Actionscript Project - Structure



Hi all i am havijng some difficulty with a certain topic.Say you have a class that centres a sprite. Thats is job. When a resize event occurs, the class repositions itself.//In this line i added an stage.addEventListener(resize) event listener INSIDE the CustomClass class so it behaves as expected but is hard codedvar centre:CustomClass = new CustomClass();However is this wrong? //You can also do this:var centre:CustomClass = new CustomClass();stage.addEventListener(Event.Resize, onCentreResize);function onCenterResize(e:Event): void{ centre.x = stage.stageWidth/2 - centre.width/2;}//and thisvar centre:CustomClass = new CustomClass();stage.addEventListener(Event.Resize, centre.onCentreResize);Whos job is it to provide the functionality of the centreSprite?



FlashKit > Flash Help > Actionscript 3.0
Posted on: 04-12-2008, 09:01 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

ActionScript Project On Flex Project
What is advantage of ActionScript project on Flex Project ?
In Flex project usage of components are easy. But in AS3 project I find very difficult to create classes for these components

Adobe Flex Builder 3 + Actionscript 2.0 Project?
hello, the agency i am now working for use macs and adobe flex 3.0, it's gonna take me some time to adapt as i am a pc user used to program on flashdevelop.

i have a cople of issue with flex and i was wondering if ppl could help me out

- ctrl+O does not exist in that software??
it seems that the only way you can open files is with your mouse... and the keyboard shortcuts are not editable? i mean i did try in the prefs, but i cant create a new shortcut, whats up with that? anybody knows a way to create a shortcut?

- as2 project
the client of the project i will be working on needs the project to be in as2, however i am not sure i can create a project in flex in as2, only in as3. am i wrong? if so, where would that option be when i create a new project?

Flex Actionscript Project With SWC Component: Curious About How It Runs?
Hey guys, I got this Actionscript Project that i downloaded. It comes with an SWC file which i've added in the library path and it has these packages and class files. When I run the project, it does what it's supposed to do, but im not sure how it's actually running because i see classes and class definitions but no instantiation of any classes?

Like, there's an addChild inside the classes, but whats actually calling these functions? It's all function declarations and definitions and no actual calls?

Any ideas?

[Flex] Creating A Flash SWF And Using It In My Flex Project?
Hi there,

I recently got the demo for txeff and i was messing around with it. Quite cool, id consider a purchase but over 100 notes for some text effects is a scandal in my own meaningless opinion.

Anyways it had me wondering about something else. For example lets take a new Flash CS3 file containg a dynamic textField instance called "tF".

Is it possible to embed the SWF into a Flex project and dynamically populate the textFields propery?


Code:
[Embed(source="/assets/textFieldThing.swf")]
public var EmbeddedTextFieldThing:Class;

var myNewTextField:Sprite = new EmbeddedTextFieldThing() as Sprite;
//PS. Just wondered, can this be also done as Sprite(new EmbeddedTextFieldThing())? and what way is correct?

myNextTextField.tF.text = "I am trying to display this text in the embedded SWF".
addChild(myNewTextField);



This dont seem to work, it was worth a try though. Can anyone else give me some knowledge if this is possible or not. I find myself often using the API in flex when i could save alot of time in Flash IDE.

Cheers

Flex Move A Flex Project From One Folder To Another
How can I relocate a Flex project on my system and reestablish the connection to in Flex Builder? I don't see an easy way to relink once I've moved it.

Project XML Structure
Hello all!

I'm working on a project that is a "build your own" type of system. The client needs to be able to select and deselect most of the products. Some items are required for others to be available. What I hope to accomplish this with is through simple XML so that it is extensible and I can manipulate it easily. Has anyone ever set up a similar structure with XML? I'm stumped as to how to do it. So far, my idea is as follows:

I've broken down the building process into six steps. In most of these steps, there are a number of choices, but only one can be selected. For each of these instances, if you select a choice, all other selected choices will be unselected.

Some steps have a simple two-level approach to them. Thus my XML will contain two levels. Only once level one is complete can level two begin.

To begin, I've started by structuring my XML document around the steps. All item elements are to be located inside of these steps. This is fine.

What is not fine, however, is that I would like to be able to access all of my elements, simply to give their names to a variable in Flash, so that I may track relevant data, such as whether the item is selected or not (keep in mind, that skipping back and forth between steps is a must -- clients must be able to customize this product to their every delight).

So, if you can follow what I just described, would there be any direction I could get pointed to find a good structure for this XML I am trying to set up? I am very poor at styling XML, so it would not only help me out with my project but be good practice for the future

Thanks in advance!

Project Structure Built Dynamically?
Hey,
This is something I frequently wonder about when taking over someone elses work. I've got an existing structure for a project - a bunch of classes all in different folders matching their class definitions. What would be nice is if Flash behaved like Visual Studio and kept it's project structure up to date like solutions can be kept in VS. Since it doesn't I have to go through typing in folder names all over the place and adding files at the end of every path.

So does anyone know if there is something that will help me create a project from a directory?

Actionscript/Flex 3 - Seeking Tutorial That Connects Flex With Various Architectures
I am looking for a step-by-step detailed tutorial that will show me how to connect the following technologies with my Flex Application (from installation to actual usage to understanding what each part does). My flex application needs to be able to save data from a datagrid in the database and retrieve it. All suggestions and examples are welcome.Thanks

# Presentation Layer

* Flex 3

# Remoting and web messaging technology Layer

* BlazeDS


# Business Layer

* Spring

# Data Access (Object-Relational Mapping)

* Hibernate

# Data Storage

* MySQL

# Application Server

* JBoss

# Build

* Ant or Maven

Preloader For Flex AS Project
I wander huw to make swf which monitor self-loading in Flex 2.0 (AS project - not mxml)

for now I have made external preloader, but I whant to understand how to made internal one

here is my external preloader:

Code:
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.TextField;

public class preloader extends Sprite{
private var tf:TextField;

public function preloader(){
stage.scaleMode = "noScale";
stage.align = "TL";

tf = new TextField();
tf.x=100;
addChild(tf);

var ldr:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("Main.swf");
ldr.load(urlReq);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
ldr.contentLoaderInfo.addEventListener( ProgressEvent.PROGRESS, progressHandler);
addChild(ldr);
}

private function progressHandler(event:ProgressEvent):void {
tf.text=event.bytesLoaded.toString();
}

private function loaded(event:Event):void {
removeChild(tf);
}
}
}

Flex Components In AS3 Project
I am trying to use the Flex components in an AS3 only project using FLex Builder

package {

import mx.core.*;
import mx.events.FlexEvent;
import mx.controls.Button;

public class UsingFlexComponents extends Application
{
public function UsingFlexComponents()
{
super();
this.layout = "vertical";
this.addEventListener(FlexEvent.APPLICATION_COMPLE TE, doInit);
}

private function doInit(e:FlexEvent):void {
var t:Button=new Button();
t.label="wassup";
this.addChild(t);
}
}
}

it compiles and runs fine but I do not see a button. ??

thanks
cheers
firdosh

How To Embed Flv In A Flex/As3 Project
I know you can use the embed tag for swf and images but how do you embed an flv file ???


thanks
cheers
firdosh

Loading Flex SWF To AS3 Project
I'm trying to load in swf-s created with Flex to a simple AS3 project but the catch is that they have to be garbage collectable.

The loading and displaying is not a problem but removing from memory is harder. I don't know of any Flex built in function for reference removal but it would be nice.

The other thing I tried is loading in just Flex modules with some success but making them fully functional would be a lot of work.


Any ideas would be appreciated.

USING ACTIONSCRIPT3 IN FLEX PROJECT
Hi,

I am trying to use actionscript 3 in flex project. I don't want to code anything in flex file (mxml) except initialization of my first class. Also want to use flex components in actionscript.

I tried but its not working, any one can help me. I am writting the code for mxml file and AS3(actionscript 3) class file code below.

code:

[MXML file code](default application file)
-------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete( event );">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import Classes.InitApp;
privatefunction onCreationComplete( event:FlexEvent ):void
{
var myInitApp:InitApp = new InitApp();
mx.controls.Alert.show("Alert1");
//Alert.show("adfka");
// ActionScript from here onwards..
}
]]>
</mx:Script>

</mx:Application>-------------------------------------------------------------

[Actionscript 3 class file code ]
-------------------------------------------------------------
package

Classes
{
import flash.display.Sprite;
import mx.containers.Canvas;
import mx.containers.Panel;
import mx.controls.Button;

publicclass InitApp extendsCanvas,
{
publicfunction InitApp()
{
super();
var myBut:Button = new Button();
myBut.id = "myB";
myBut.label ="aaaa";


var myPp = new Panel();
myPp.id = "myP";
addChild(myPp);
myPp.addChild(myBut);
mx.controls.Alert.show("Alert2 "+myBut);
}
}}

-------------------------------------------------------------

In case there is any confusion, please write back to me.

Uploading A Flex Project?
How the heck do you upload a compiled flex project? do you upload the whole project folder or just the swf and the html page?

lol, it was a lot easier in flash 8 ;)

Anyone Know How To Embed Fonts In A FLEX 2.0 AS/3 Project?..
The docs seems completely silent on this (other than to assert the embed metadata tag can be used to do it). Macdobe gives us examples of jpgs, pngs, wav files, even movie clips from swfs but nothing on fonts (at least that I've found).

Any ideas??

TIA - wlovin

[NeedHelp]AS3 And MXML Project In Flex 2
Hey guys! (First time asking for help here hehe..) I have to make a project for school. It will be like a tutorial, but into an application. I already made a part of it in MXML and a bit of action script but I encountered a few problems that are over my newbie limits. So the Flex Builder 2 makes a SFW file, in the main folder of the "project".

I want to make that SWF file my main executable file. I have a folder with some pics, and another folder with Action Script Files. The code lvl that I know atm is ABSOLUTE BEGINER... I don know how to make my SWF file have a specific name when I run it.Here is a picture of a training exercices that should make thing more clear:



Some people told me that I should use a HexEditor and stuff. Is it ture(what u think?).

Next problem. I dont know how to make the Stage to be fix. I mean.. I dont want the stage to be resizeble. I tryed to change the stagescalemode but that wasn't it. I toke a look at the help files of Flex from the net, about the Resize action and SystemManegment, but I didn't find out what I wantend. Maybe it's something simple, but I got tired of searching and decidet to ask for help here.

I think the issue is about ActionScript. If not.. So sry for posting in the wrong section.

Thx for u're time and help!

Agilius Out.

Advice Needed On Project Feasibility - Flex
I currently have an app that works quite nicely written in Javascript, HTML and PHP but I have this annoying feeling it could be done much better in Flash/Flex etc.

So if you wouldn't mind casting your eyes over the following and give your thoughts and opinions as to this projects feasibility before I launch into attempting it!

The Principle
example
I have 150 frames for an animation that need to be loaded and then run as an animation.
Whilst the animation is running I need the ability to adjust the contrast and brightness of the frames - on the fly. There is also image zooming required.

Along with this there is information and data to be loaded into 'panels'. This information is details of the animation and notes.

Current Solution
As I briefly mentioned, this is currently built in javascript and html.
It works fine as it is but I want more interaction and user experience.

Questions
Can this be done.....!
From the research I have done so far and the tutorials I have read, the information - including image lists can be done in XML and then loaded at runtime...?

The image manipulation; I get the slider inputs fine and the way they work with zooming an image etc but how possible is it to get the contrast and brightness functionality?

Final thing - this needs to be run locally, so no web server or web services can be used. This is the main reason for looking at Flex/AIR.

So what are your thoughts, musings or am I going down the wrong path?!

Cheers

Spike

Center Swf In Browser When Compiling As3 Project In Flex Builder
Hi,

when you publish a swf from within the flash ide and put the publish settings on 100% x 100%
noscale
html alignment : default
flash alignment : center center
the swf will appear in the center of the browser, horizontally and vertically speaking.

But when I compile an as3 project with flex builder, I can't get this done.

What would be the way to compile so that the swf is noscale and centered in the middel of the browser?

I tried


Code:
[SWF(backgroundColor="#ffffff", frameRate="40" )]

public class Main extends Sprite{


public function Main(){

stage.align = StageAlign.TOP_LEFT;//tried it with or without this line
stage.scaleMode = StageScaleMode.NO_SCALE;
etc...
I compared both html sources but they don't seem to differ, so I'm pretty confused. Both have width and height 100% and align = "middle"

thanks,

Jerryj.

How To Get Stage Width And Height In Flex Builder AS3 Project
I'm using Flex Builder to code an AS3 project that does not use the flex framework. I want to position my elements dynamically based upon the stage width and height. Unfortunately I do not seem to have immediate access to stage properties. The following code shows my problem:

ActionScript Code:
package
{
    [SWF(width='800', height='430', backgroundColor='#000000')]
    public class app extends Sprite
    {
        public function app():void
        {
            trace(stage.stageWidth);         //0
        }
    }
}

Is there an event that gets dispatched when the stage has been created and sized? I've already tried listening for the following events.
Event.RESIZE
Event.COMPLETE
Event.INIT
Event.ADDED_TO_STAGE
FlexEvent.CREATION_COMPLETE
FlexEvent.APPLICATION_COMPLETE

Event.ADDED_TO_STAGE is the only one that gets dispatched, and at that point stage.stageWidth still returns 0.

Flex ActionScript In Flex
I am creating a button dynamically, but i could not get the ID of the button.


Quote:




b1.label = "Close";
b1.addEventListener(MouseEvent.CLICK, closePopUp);
b2.label="Other Information";
b2.id="stateBut1";
b2.addEventListener(MouseEvent.CLICK, changeState);




Now Flex Builder points this as error...


Quote:




private function changeState(evt:MouseEvent):void
{
if(stateBut1.click == true)
{
currentState = "state1";
}else
{
currentState=""
}
}




It says that acesss to undefined property stateBut1. Now how should i call the id in my function.

All i wanted is to create a dynamic button via ActionScript and then perform a logic if that is clicked or not.

AS3 Project In FDT + Flex SDK. Root Class Extends Visual Class From Swc
hello
question about compiling as3 project under FDT 3.0 with Flex SDK.

I want my main root class to contain some graphics already at the start. In Flash IDE I put some objects on the stage, make new symbol with all those objects inside, set linkage to MainClassGraphics, export it to swc, add this swc to source folder class-path. Then I write my root class:

Code:
package {

public class MainClass extends MainClassGraphics {
public function MainClass() {
trace('hey');
}
}
}

compiling with flex2 sdk - and I don't see any graphics. why?

if i try this way:

Code:
package {
import flash.display.Sprite;

public class MainClass extends Sprite {
public function MainClass() {
var s:Sprite = new MainClassGraphics();
addChild(s);
trace('hey');
}
}
}

then I see my graphics.. so swc looks like fine


crosspost here http://fdt.powerflasher.com/forum/vi...hp?f=21&t=2268

Wondering About Movie / Actionscript Structure
Hi Guys, I'm looking for advice.

I'm making a game in flash that is basically linear.

-Game setup functions run
-Wait for user input
-Do other stuff
-Wait for user input
-Do other stuff
-Wait for user input
-End Game

I was thinking of programming this all in one frame of actionscript. However I soon realised that this could get messy. What code and animation structure should I use to layout this game?

The main linear element of the game will cause different animations to play at different times, there's some setup functions. I guess I'm finding it hard to explain, but are there any examples of how to separate stuff out? My main concern is finding a clear way to control the animation flow.

Flash ActionScript == Flex ActionScript?
Is ActionScript basically programmed the same way for Flash as it is for Flex? I know some folks who develop in AS for Flex. I didn't know if it was exactly the same for Flash, so I could tap them as a resource when I have an AS question.

Thanks,
Loren

Actionscript 3 Flex On IRC ?
Is there a actionscript / flex channel on IRC ??

cheers
firdosh

ActionScript 3.0 And Flex
I am new to AS 3.0 and going through the tutorials. One thing that is confusing me is that .. if i create a movie in FLASH CS 3 with AS 3 programming in it .. is it same as FLEX ?

I mean is AS 3.0 and FLEX are same things or not ?

mostly it is happening that if i search for AS 3.0 resources and i find something like this .. "AS 3.0 - Flex 2" .. which confuse me whether the thing I'll learn from here will be an AS 3.0 thing which will help me in some *HIGHLY DYNAMIC MOVIE USING AS 3.0* or not.

Actionscript 3 Into Flex
Hi guys,

I have built a calculator in actionscript3 in flash. However, I now need to use it in a flex app and was thinking the best way to do this would be to create an actionscript class in my flex project.

I have no idea how to do this though. In the actionscript I am calling on the instances which are obviously not available in the flex class. I really cant get my head around classes in flex so any help would really go along way to getting me there.

I have a movieclip called calculator and within that a number of buttons that have the functions on them. Can I import just calculator into flex or do I have to import each button separately?

attactched is the actionscript 3 actions layer that I have in flash.

Attach Code
calculator_mc.calc_Btn.addEventListener(MouseEvent .CLICK, calcClick); calculator_mc.reset_Btn.addEventListener(MouseEven t.CLICK, resetClick); calculator_mc.zero_Btn.addEventListener(MouseEvent .CLICK, zeroClick); calculator_mc.one_Btn.addEventListener(MouseEvent. CLICK, oneClick); calculator_mc.two_Btn.addEventListener(MouseEvent. CLICK, twoClick); calculator_mc.three_Btn.addEventListener(MouseEven t.CLICK, threeClick); calculator_mc.four_Btn.addEventListener(MouseEvent .CLICK, fourClick); calculator_mc.five_Btn.addEventListener(MouseEvent .CLICK, fiveClick); calculator_mc.six_Btn.addEventListener(MouseEvent. CLICK, sixClick); calculator_mc.seven_Btn.addEventListener(MouseEven t.CLICK, sevenClick); calculator_mc.eight_Btn.addEventListener(MouseEven t.CLICK, eightClick); calculator_mc.nine_Btn.addEventListener(MouseEvent .CLICK, nineClick);

var mileage:String = '';

function zeroClick(event:MouseEvent):void {
mileage = mileage + '0';
calculator_mc.result_Txt.text = mileage;
trace(mileage); }

function oneClick(event:MouseEvent):void {
mileage = mileage + '1';
calculator_mc.result_Txt.text = mileage; }

function twoClick(event:MouseEvent):void {
mileage = mileage + '2';
calculator_mc.result_Txt.text = mileage; }

function threeClick(event:MouseEvent):void {
mileage = mileage + '3';
calculator_mc.result_Txt.text = mileage; }

function fourClick(event:MouseEvent):void {
mileage = mileage + '4';
calculator_mc.result_Txt.text = mileage; }

function fiveClick(event:MouseEvent):void {
mileage = mileage + '5';
calculator_mc.result_Txt.text = mileage; }

function sixClick(event:MouseEvent):void {
mileage = mileage + '6';
calculator_mc.result_Txt.text = mileage; }

function sevenClick(event:MouseEvent):void {
mileage = mileage + '7';
calculator_mc.result_Txt.text = mileage; }

function eightClick(event:MouseEvent):void {
mileage = mileage + '8';
calculator_mc.result_Txt.text = mileage; }

function nineClick(event:MouseEvent):void {
mileage = mileage + '9';
calculator_mc.result_Txt.text = mileage; }

var result_Value:Number;

function calcClick(event:MouseEvent):void {
result_Value = parseInt(mileage) + 5;
calculator_mc.result_Txt.text = 'Saving: £' + result_Value.toString();
if (mileage == ''") {
calculator_mc.result_Txt.text = '0'; } }

function resetClick(event:MouseEvent):void {
calculator_mc.result_Txt.text = 'Enter your milage..';
mileage = "''; }

Flex ActionScript Help
I am creating a button dynamically, but i could not get the ID of the button.

PHP Code:

                                b1.label = "Close";                b1.addEventListener(MouseEvent.CLICK, closePopUp);                b2.label="Other Information";                b2.id="stateBut1";                b2.addEventListener(MouseEvent.CLICK, changeState);


Now Flex Builder points this as error...


PHP Code:

private function changeState(evt:MouseEvent):void            {                if(stateBut1.click == true)                {                    currentState = "state1";                }else                {                    currentState=""                }            }


It says that acesss to undefined property stateBut1. Now how should i call the id in my function.

Help With Learning Actionscript And Flex
I've decided that I want to try to learn some Flex/Actionscript (I understand how to use flex to make forms and stuff like that, but I want to learn how to make things that are a little more interactive, like a game). My previous programming experience is limited to PHP and some simple python.

First, if anyone knows of any good Actionscript tutorials that deal with Flex and not Flash could you please point them out to me, so far I haven't been able to find any.

Second, this is a rough plan for how I want to go about learning (but it can always be subject to change if anyone has any good suggestions). I want to start out with a simple script and slowly tack code onto that, my idea of a base script is something that just displays an image at x and y coordinates. After I've got that working and understand how and why it works I would like to move on to adding something that makes that image move around by excepting keyboard input. After that I'm hoping to have the generals on how both user input and graphics stuff work and I'll decide what to add on next when I get there.

So, what would the easiest way be to make a .swf using flex 3 and action script 3 that will display a 32x32 picture at some set coordinates?

ActionScript (Flex / AIR) And Reuters
Is anyone doing any work integrating with Thompson Reuters products and services? Specifically, I'm interested in building clients (consumers) for Reuters Market Data Systems hosted either by Flash Player or AIR.

Any pointers wrt ActionScript bindings for Reuters Foundation API (RFA) or Reuters Source-Sink Library (RSSL) would be much appreciated.

I'm at the very early stages of this, so please let me know if you've tried it and what your experiences were, or if you know of any third party offerings that can facilitate such integration.

Thanks,

W.

Flex ActionScript Problem
Quote:




<?xml version="1.0"?>
<!-- statesStatesAS.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="createState();" >

<mx:Script>
<![CDATA[

import mx.states.*;
import mx.controls.Alert;
import mx.containers.Panel;

// Variable for the ActionScript-defined view state.
private var newState:State;
// Initialization method and
// creates a view state using ActionScript.
private function createState():void {
newState = new State();
newState.name = "state1";
var panelanel;
panel = new Panel();
panel.title = "All about Me";
panel.width = 500;
panel.height = 300;
newState.overrides[0] = panel;
states.push(newState);
}
]]>
</mx:Script>

<mx:HBox id="myHB" height="50%" width="50%">
<mx:Button label="Base state" click="currentState='';"/>
<mx:Button label="Change state" click="currentState='state1';"/>
</mx:HBox>
</mx:Application>




My Question is suppose if i have two buttons in ActionScript how would i call this state. I am confused totally on this.

Next..

I get an error stating in runtime when i click the button ...


Quote:




TypeError: Error #1034: Type Coercion failed: cannot convert mx.containers:anel@3daac29 to mx.states.IOverride.
at mx.states::State/http://www.adobe.com/2006/flex/mx/internal::initialize()[E:dev3.0.xframeworksprojectsframeworksrcmx statesState.as:199]
at mx.core::UIComponent/initializeState()[E:dev3.0.xframeworksprojectsframeworksrcmx coreUIComponent.as:7216]
at mx.core::UIComponent/commitCurrentState()[E:dev3.0.xframeworksprojectsframeworksrcmx coreUIComponent.as:6994]
at mx.core::UIComponent/setCurrentState()[E:dev3.0.xframeworksprojectsframeworksrcmx coreUIComponent.as:6948]
at mx.core::UIComponent/set currentState()[E:dev3.0.xframeworksprojectsframeworksrcmx coreUIComponent.as:4260]
at example/___example_Button2_click()[C:developmentGategourmetIFXIFXGGSourceifx ru nkIFXWEBmxmlVinothBabusrcexample.mxml:33]




How can i possibly overide the mx.containers with the state.

Can anyone Help me.

Actionscript 3.0/Flex Newbie Having Troubles
I have some familiarity with Flash IDE and AS2. It's ASC3, both in Flash IDE and Flex.

I've worked on a few tutorials from books and online and have been having some trouble. I think it might relate to packages and encapsulation.

Here the code that works when I put it on a frame in Flash IDE:

------------On Flash Timeline _------------------------------------------------

// create a line from 100,200 to 150,250
this.graphics.lineStyle(2,0x000000);
this.graphics.moveTo(100,200);
this.graphics.lineTo(150,250);

// create a curve and then another line
this.graphics.curveTo(200,300,250,250);
this.graphics.lineTo(300,200);

// draw two rectangles
this.graphics.drawRect(50,50,300,250);
this.graphics.drawRoundRect(40,40,320,270,25,25);

// circle and ellipse
this.graphics.drawCircle(150,100,20);
this.graphics.drawEllipse(180,150,40,70);

// draw a filled circle
this.graphics.beginFill(0x333333);
this.graphics.drawCircle(250,100,20);
this.graphics.endFill();



I have the code below a few different ways with both Flex Builder 3 and FlashDevelop/Flex SDK. I've gotten errors, like package may not be embedded. The code below, I get code 1120 error, I've also tried replacing Smiley with "this" and it still doesn't work.

-----------------In MXML file --------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>
<![CDATA[


// First we refer to this, as in the stage, so we will draw graphics on the stage and set the line style
// a black with a 2 px thick line.
Smiley.graphics.lineStyle(2,0x000000);

// draw circle, this is the outer of the head shape, and we give it a yellow fill, because it is a smiley.
Smiley.beginFill(0xf0ff00);

// we specify a x and y position for the circle and a radius to tell how big it should be.
Smiley.graphics.drawCircle(200,180,140);

// now we tell flash to stop drawing and find a starting point to draw a line.
Smiley.graphics.moveTo(100,200);
Smiley.graphics.lineTo(150,250);

// create a curve and then another line for the mouth part of the smiley
Smiley.graphics.curveTo(200,300,250,250);
Smiley.graphics.lineTo(300,200);

// draw two filled (black) circles for the eyes to finish up our smiley face.
Smiley.graphics.beginFill(0x000000);
Smiley.graphics.drawCircle(250,100,20);
Smiley.graphics.drawCircle(150,100,20);
Smiley.graphics.endFill();



]]>
</mx:Script>

</mx:Application>


In this case I get error 1120 access of undefined property. I've tried the cose as an .as and in the CDATA in the MXML file. I've gotten errors about packages can not be embeded.


I'm sure a making a few newbie errors that I need to over come to move forward. Can someone set me in the right direction as to what I'm doing wrong?

Thanks

Chuck!

Actionscript Confusion (flex - Flash)
Hello

I have recently started learning flash (actionscript 3).

I've been wondering if its possible to compile .as (actionscript files) using just flash cs3 or do I need flex for that? If yes, how can I do that? Is there any good tutorial online? Maybe a right phrase that I should search for?

If no, how is it possible to extend the own flash project with using those actionscript source files?

I've been searching internet but couldnt find an answer.

Many thanks in advance!

Flash To Flex, Actionscript Translation
Can someone translate this Flash actionscript into Flex actionscript? I want to save text out a richtextbox id rte to a server. Then get the text back from the server and into the richtextbox. This is the Flash code:

var textValue = "";

function saveIt(eventObj:Object){

textValue = "textValue=";
textValue += rte.text;
_root.loadVariables("save.php","POST");
}

function getIt(){
_root.loadVariables("text/text.txt","POST");
var display:Array = textValue.split("=");
rte.text = display[1];
}
saveButton.addEventListener("click",saveIt);
getButton.addEventListener("click",getIt);



<mx:Button id="saveButton" x="97" y="231" label="Save"/>
<mx:Button id="getButton" x="97" y="275" label="Open"/>

Thanks,

JW

Flex - ActionScript 3 - Java Backend
Hey Guys,

I'm a Java Coder. Don't shoot me
In the last couple of weeks I've been amazed at the power of Flex based RIA's so I felt the need to test stuff out.

I'm using Eclipse Europa + Flex Plugin and a Tomcat Server on which normally LifeCycle DS & BlazeDS (in so far these are different...) are present.

Anyway, I've been trying to use AMF to communicate with a Java Backend program from within a Flex RIA. And I must say I find it rather easy. So far, all is well!

However...

I'm at the point where I need to interpret my Java beans (pojo's if you will) at client side. There is however one small catch: my Java Backend is created in a seperate Flex Project in my Eclipse.
This implies, I think, that the [RemoteClass(alias="...")] system might not be as straightforward as I found on different websites.
Furthermore, my Eclipse Content Assistent doesn't recognize the "RemoteClass' metatag, hence no coding help there

I have been able to directly call the public variables in my java backing bean, but as other java coders out there might understand, the concept of publicly declaring variables makes me shiver...
So I just want to map my server side bean (with private variables & public getters/setters) to a client side AS bean (with private variables & public getters/setters) and if possible in such a matter I can use an action to 'refresh' the bean on client side

So basically I got one 'simple' question... How do I interpret my Java backing bean in my Flex RIA, keep in mind above stated situation please!

Flex/ ActionScript Tile Component
While developing in flex I ran into a bit of trouble using the Tile component. I am looping through a Array of data and adding children (Labels to be exact) to a Tile component. I am having trouble getting the Tile component to grow in height as I add children. It seems to be stuck at a certain height. I am sure that I am not limiting it by the height of its parent.

Does anyone know if there is a bug on this component or am I doing something wrong? Any help will be appreciated.

Embedding In Flex Actionscript Projects
So I've taken to doing a few things and I would like comments on it please.

I like Flex as a development environment because of the way it organizes classes; I've been makingActionScript projects in Flex. However, since I still kind of like building the interface in Flash, rather than using MXML, I will make a flash file, and then embed the .swf in Flex using something like this:

Code:
[Embed(source="multipleChoice.swf", symbol="multipleChoice")]
public class MultipleChoiceGame extends MovieClip
{
public function MultipleChoiceGame() {

}
}
Where 'multipleChoice' is the name of a symbol in the library of multipleChoice.swf

If I just try to use:

Code:
[Embed(source="multipleChoice.swf")]
then I get an error that it "results in generated code, cannot use existing class 'MultipleChoiceGame'"

Is there any way to embed the contents of the stage of the .swf rather than having to embed a symbol?

Also, when I search for examples of embedding, I usually find people doing stuff like this:

Code:
[Embed(source="assets/logo.png")]
[Bindable]
public var Logo:Class;
Is there a reason why my method isn't more popular?

Flex For Flash Actionscript Tutorial Help
Hi!

I follofed Flex for Flash Actionscript tutorial step by step exept that my papervision classes are located elsewhere... anyhow they worked inside flex like in the tutorial, code hinting and importing but inside Flash when testing movie I get errors starting from line 4
And so on, seems like papervision classes are not recognized by flash or sth...

You guys must know what is wrong, pls help!

ActionScript/PHP Project Help
I am looking for someone to write some actionscript code that will work with PHP and MySQL database. I am not proficient in actionscript to get this done, nor do I have the time right now to figure it out.

Someone with experience may be able to get this done in about 2-3 hours.

Please post your reply with an email address to talk further.

Please forgive me if this is not the right place to post help wanted signs!

Thanks in advance.

M Dell

ActionScript 3 Object Tracer For Flash CS3 And Flex
Here you can see a free open source ActionScript 3 object tracer for Flash CS3 and Flex. Any comments and suggestions are appresiated.

http://blog.bodurov.com/Post.aspx?postID=13

[Flex 2] Embedding Fonts In Actionscript Projects
Well the topic pretty much explains what I am after. I need to know how to Embed fonts in to my swf without using the Flash IDE.

The Flex 2 Help shows how to do it for Flex 2 applications and how to do it through the Flash IDE, but not how to embed fonts in Actionscript Projects.

Any help would be greatly appreciated

Flex Actionscript Class & MXML Component
Hi all,

I was using AS3 projects in Flex for a year and started playing with Flex recently.

I am not infront of a Dec PC but i was wondering if someone can confirm this correct?

If i make an actionscript class called MyClass.

class MyClass
{
public var justaproperty:int = 0;

public function MyClass()
{
trace("a new class was created");
}
}

Does that mean that i can automatically use a flex component like this or is there more to it?

<local:MyClass id="myClass" justaproperty="15" />

Thanks.

Flash Tutorial: Classes In ActionScript 3 - How To In Flex
So I bought a book to learn flex and AS3 but the thing got too diffucult to read. I searched and happened upon the tutorial and its great I am actually comprehending the concepts.
But since I am in Flex, I am not building an .fla so what kind file should I put the codes samples in and are there needed changes ? I assume it should be an MXML titled classes and the name file remains a .as file.

Should Flash Actionscript Coder Learn Flex?
should Flash Actionscript coder learn Flex? Is it redundant work to do which the two products deliver same thing

[Flex 2] Embedding Fonts In Actionscript Projects
Well the topic pretty much explains what I am after. I need to know how to Embed fonts in to my swf without using the Flash IDE.

The Flex 2 Help shows how to do it for Flex 2 applications and how to do it through the Flash IDE, but not how to embed fonts in Actionscript Projects.

Any help would be greatly appreciated :)

[CS3] Actionscript To Link Within A Project?
I am trying to use actionscript to have a button start a new flash movie that is contained within the project the first button is in.
Thanks!

Need ActionScript God For Freelance Project
I have a Flash multiple choice questions game project where I need an advanced ActionScript freelancer to build the functionality using our graphics.

Functions of project:
1. The player needs to log in. The login is their email address. The game keeps track of their score and totals the points they get if they play multiple times.

2. The Q&A function where it poses a question and if they get it right or wrong, it presents the next step, which is to select a part of a car that they build. There are six questions.

3. The building a car function. When a question is answered correctly, they get 3 choices for parts that build a car for 6 sections of the car. If they get it wrong, they get stuck with a predetermined part that is silly and isn't cool.

4. Email final image of car to the player's email address, and CC the same image to a different address every time (an employee of the client)

5. Tally of top players' scores for the current day and to date (3 day tradeshow) displayed at end of game.

Project is April 29th - May 8th. Please email me if you are interested at scot@swproductions.com

Thanks

Actionscript To Get Dimensions Of Project?
I'm trying to get the dimensions of the project ( x max, y max) to handle boundries. I'm just getting into this, so i need some help helping myself. I was trying to look at the data members of _root. but didn't find anything fitting the mold. Am I just missing the object here... Else than running to a board, where would a good place to have found this have been?

Actionscript/Flex 3 - Communicating With An ItemRenderer From The Main Application
I know that if you want to communicate with the main application from within the itemRenderer component, you have to use "outerDocument" first...Example:

<mx: DataGridColumn dataField="field" headerText="col1" editorDataField="text" editable="true">

<mx: itemRenderer>
<mx: Component>
<mx:ComboBox dataProvider="{outerDocument.myXml.info}"
change="myMethod(dg.instanceIndex)" id="cbItemRenderer"/>
</mx: Component>
</mx: itemRenderer>

</mx: DataGridColumn>


My question is:
---How do you communicate with an itemRenderer from within the main application? It seems like the main app does not have scope to the itemRenderer, because when I add an id attribute to the <mx:ComboBox> tag, I cannot refer to it...Example:

cbItemRenderer.getSelectedItem().label)


Thanks

Can Anyone Write A Actionscript For Flash Project
Hi All,
Can anyone write a Actionscript for my project.
I want to develop my project with the flash.
My project scenario is, I have total no of 60 (.swf) flash movies and are about to take 4 to 5 minutes each, my aim is to display 20 .swf files randomly at a time on the screen.
i.e., if we click on a button for the first time, it should display a 20 flash movies on the screen and when we click for the second time it should display other set of 20 flash movies it may or may not repeat the previous ones. It means every person should be displayed with a different set of flash movies, no two persons can get the same set of movies. The movies should be randomly selected.
Could you please direct me to meet my scenario, could you please write a script for my flash.

Thank you for your precious time.

Copyright © 2005-08 www.BigResource.com, All rights reserved