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.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 01-24-2006, 09:47 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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
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 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!
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.
Does Flash/Flex/ActionScript Support Unicode Surrogate Pairs?
Does Flash/Flex/ActionScript support Unicode surrogate pairs?
I read those pages, but they don't mention about surrogates.
http://livedocs.macromedia.com/flex/201/langref/String.html
http://livedocs.macromedia.com/flex/201/html/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part2_DevApps_048_1.html
So, probably surrogates are not supported.
Then, please consider support of surrogates in future releases of Flash/Flex/ActionScript.
Surrogate pairs will soon be widely used with arrival of Windows Vista, so I believe it is very
important for Flash/Flex/ActionScript to support surrogate pairs to be a dominant platform
in rich internet application domain.
If you want to know about surrogate pair, these pages may be a good start.
http://en.wikipedia.org/wiki/Surrogate_pair
http://java.sun.com/developer/technicalArticles/Intl/Supplementary/
Regards
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.
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.
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 coded
var 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 this
var centre:CustomClass = new CustomClass();
stage.addEventListener(Event.Resize, centre.onCentreResize);
Whos job is it to provide the functionality of the centreSprite?
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!
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 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
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 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.
[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 :)
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
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?
[F8] Flash6 Actionscript 2, Flash 8 Actionscript 2...help
Ok loosing it a bit now, have gone back to a very old project from a Flash 6 file, managed to convert the script language to ActionScript2, works fine as flash6 actionscript2, but once I change the project to be flash 8 I get One error......and I know where it's coming from (see below), Have come to a dead - end here, so hope that one of you guys may be able to help me....
Feel free to use this if you can get it working, just credit the designer (Me).
On the main stage MC named "site", go inside and double click on any of the MC's (named "str0, or str1 etc....all instances). Once inside an "str" MC move to frame 2 and the MC on the stage should be called "seg0 or seg1 etc...(again all instances"), go inside the MC and click on frame 1 of the actions layer. Scroll down and look for the variable named "var nummer = _parent.plus+Number(this._name.substr(3, 1));"....this always returns NaN in flash player 8, but works in flash player 6?.................help me.....I'm drowning.
link to files:
http://www.solidvision.co.uk/dev/help.zip
[CS3] Needs Help Converting Simple Flash 5 Actionscript 1.0 To Flash 8 Actionscript 2
Hi, can anyone help me convert this code to actionscript 2.0
I will separate it into the frames its on.
Frame 1
i = 1;
max = 60;
x = getProperty("fire", _x);
Frame 2
if (Number(i)<=Number(max)) {
duplicateMovieClip("fire", "fire" add i, i);
i = Number(i)+1;
}
Frame 3
if (Number(i)<=Number(max)) {
duplicateMovieClip("fire", "fire" add i, i);
i = Number(i)+1;
}
gotoAndPlay(2);
Thanks i appreciate any help
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
Flex Reconnect Flex To Debugger Flash Player
I upgraded my OS (OSX) and Flex seems to have lost its connection to the the Debugger version of my Flash Player. I don't see an easy way to re-establish the connection. I've already directed the OS to open all .swfs in the debugger version of the player.
ActionScript 2.0 To ActionScript 1.0 Using Flash 8
Hi there, I've a contact form with input fields, but, in some area of this form I've placed a combobox drop down menu, wich is a component, I'm using flash 8, so everything was working fine untill my client saids he needs that working in Actionscript 1.0 and the movie published for the flash player version 6, in my button I've this code
on (release) {
Enquiry = (comboBox1.getSelectedItem().label);
_root.test.text = este;
gotoAndPlay("gracias");
this.loadVariables("contacts.php", "POST");
}
thing here is because of the player version update now my dropdown menu is not working, just wondering if somebody can help me with this?
Thanks a lot!!
Arturo
Flash 8 V. Flash MX 2004, ActionScript, Actionscript 3
I have a question:
Could someone explain the material differences between Flash 8 and Flash MX 2004, ActionScript and ActionScript 3?
Can Flash 8 ($699 retail version) do everything that the other three can do?
Thank you very much for your time and response.
[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
[FLASH+FLEX] Call A Method In A Flex Swf From As3
Hello
here it is:
i have a flex file with methods inside and some as3 swf
The idea is to load the flex file in as3 swf, and when flex file is loaded, call a method from the flex file
here is the code process
Code:
var _loader:Loader = new Loader();
var flexAppli:URLRequest = new URLRequest("flexfile.swf");
_loader.contentLoaderInfo.addEventListener(Event.INIT, onLoadInit);
_loader.load(flexAppli);
and
Code:
private function onLoadInit(event:Event):void
{
var loader:Loader = Loader(event.target.loader);
var newSprite:MovieClip = new MovieClip();
newSprite.name = "LeFlexCharge";
newSprite.addChild(loader.content);
addChild(newSprite);
setChildIndex(newSprite, 0);
// here the method call
newSprite.mymethod(); //dont work
}
The problem is : when calling the mymethod from flex file, it does not work
So i did a trace on all elements in as3 file and i get an object like this
_MyFlexAppli_mx_managers_SystemManager
First question : What's this ?
Second Question : How to call my method ?
Thx for yr help
tofu
[FCS3] Adding Actionscript To A Movieclip Through Actionscript?
Yo, is there a way to add actionscript to a movieclip created in actionscript? Such as a onClipEvent(load) and onClipEvent(enterframe)? I have a onEnterFrame already for the movie clip as its created though. I have taken code thats from a gravity tutorial where it uses the two methods above. I've tried adding them into the onEnterFrame that I had already to add gravity to the movieclips created though that did'nt work =(
Jigsaw Puzzle - Changing From Actionscript 2.0 To Actionscript 3.0
Hello Everyone,
I was hoping someone could help me convert the following actionscript from actionscript 2.0 to actionscript 3.0. I'm trying to complete a jigsaw puzzple but I'm having problems converting it into actionscript 3.0.
Below is my actionscript:
//Puzzle Pieces
scramble_btn.onRelease = function(){
piece1._x = random(250);
piece1._y= random(250);
piece2._x = random(250);
piece2._y= random(250);
piece3._x = random(250);
piece3._y= random(250);
piece4._x = random(250);
piece4._y= random(250);
startGame();
messageOn.text = "";
counter.text = "00:00";
clearInterval(timeStarted);
timeStarted = setInterval(countdown, 1000);
time_start = 0;
}
//Puzzle Move
function startGame(){
piece1.onPress = function(){
this.startDrag();
piece1.swapDepths(1)
}
piece1.onRelease = function() {
this.stopDrag();
hit1();
checker();
};
piece2.onPress = function(){
this.startDrag();
piece2.swapDepths(1)
}
piece2.onRelease = function() {
this.stopDrag();
hit2();
checker();
};
piece3.onPress = function(){
this.startDrag();
piece3.swapDepths(1)
}
piece3.onRelease = function() {
this.stopDrag();
hit3();
checker();
};
piece4.onPress = function(){
this.startDrag();
piece4.swapDepths(1)
}
piece4.onRelease = function() {
this.stopDrag();
hit4();
checker();
}
};
//HitTest Script
function hit1(){
if(piece1.hitTest(container1)){
piece1._x = container1._x;
piece1._y = container1._y;
}else{
piece1._x = random(250);
piece1._y = random(250);
}
}
function hit2(){
if(piece2.hitTest(container2)){
piece2._x = container2._x;
piece2._y = container2._y;
}else{
piece2._x = random(250);
piece2._y = random(250);
}
}
function hit3(){
if(piece3.hitTest(container3)){
piece3._x = container3._x;
piece3._y = container3._y;
}else{
piece3._x = random(250);
piece3._y = random(250);
}
}
function hit4(){
if(piece4.hitTest(container4)){
piece4._x = container4._x;
piece4._y = container4._y;
}else{
piece4._x = random(250);
piece4._y = random(250);
}
}
//Timer
counter.text = "00:00";
function countdown() {
started();
time_start = time_start+1;
if (time_start>10) {
messageOn.text = "GAME OVER!!!";
clearInterval(timeStarted);
}
}
function started(){
sec = Math.floor(time_start+1/1000);
sec = (sec<10)?"0"+sec:sec;
min = Math.floor(sec/60);
min = (min<10)?"0"+min:min;
counter.text = min+":"+sec;
};
//This will check if all puzzle pieces are complete...and display game finish messsage.
function checker(){
if((piece1.hitTest(container1)) && (piece2.hitTest(container2)) && (piece3.hitTest(container3)) && (piece4.hitTest(container4))){
messageOn.text = "CONGRATULATIONS!!!";
clearInterval(timeStarted);
}
}
Giving Actionscript To An Actionscript-loaded Movie
How can I (if possible) set actionscript (say, an on-mouse event) to a movie that I load via attachMovie()? I poked around and I couldn't seem to find an answer...
I want the movie that I load via attachMovie() to have an on(RollOver) event...any thoughts?
Warning: An ActionScript 1.0/2.0 SWF File Has Loaded An ActionScript 3.0 SWF;
Hi all,
I'm trying to clone an swf (produced in CS3) that has been loaded into my app (built using Actionscript/mxmlc) but keep getting the following message appear in my logs:
Code:
Warning: An ActionScript 1.0/2.0 SWF file has loaded an ActionScript 3.0 SWF; code in the ActionScript 3.0 SWF will not run.
I know the CS3 swf has been produced using Actionscript 3 as it's settings and published for FP9. It does nothing more than a motion tween of a graphic.
Here is a really simple example of how to emulate the problem:
ActionScript Code:
package{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
[SWF(backgroundColor=0x000000)]
public class Test extends Sprite{
private var _mc:MovieClip;
public function Test():void{
var mc:String = "rain.swf";
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loadedSWF);
ldr.load(new URLRequest(mc));
}
private function loadedSWF(e:Event):void{
var mc:MovieClip = MovieClip(e.target.content);
this._mc = MovieClip(new (mc.constructor)());
this.addChild(this._mc);
}
}
}
I'm using the following version of mxmlc: Version 3.0.0 build 1844
I've also tried a slightly more convoluted way:
ActionScript Code:
package{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.utils.getQualifiedClassName;
import flash.net.URLRequest;
[SWF(backgroundColor=0x000000)]
public class Test extends Sprite{
private var _mc:MovieClip;
public function Test():void{
var mc:String = "rain.swf";
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loadedSWF);
ldr.load(new URLRequest(mc));
}
private function loadedSWF(e:Event):void{
var c:Class = Class(e.target.applicationDomain.getDefinition(getQualifiedClassName(e.target.content)));
this._mc = new c();
this.addChild(this._mc);
}
}
}
I would like to know what's causing the warning message, am I doing something wrong?
Actionscript - User Input Actionscript
I am trying to develop a way where by a users input can determine the number of fields in a form e.g. the user inputs the number 3 then the form would have 3 fields
can you show me or point me in the direction of an example i can look at and manipulate?
Moving A Game From Actionscript 1.0 To Actionscript 2.0...
Hi there.
I hope someone can help me out here. I have been asked to create a simple Flash memory game, and I have been given a template to use as a basis. However, this template has been created in Actionscript 1.0 for Flash player 5. I now need to transfer it over to Actionscript 2.0 Flash player 8, and Ive noticed lots of odd behaviour once it has been changed.
Here is the code....
Code:
initGame();
stop();
function initGame() {
// make sorted list of cards
cardsListOrdered = [];
for (i=1; i<=18; i++) {
cardsListOrdered.push(i, i);
}
// shuffle list
cardsListSorted = [];
while (cardsListOrdered.length>0) {
r = int(Math.random()*cardsListOrdered.length);
cardsListSorted.push(cardsListOrdered[r]);
cardsListOrdered.splice(r, 1);
}
// create card clips and assign their location and picture
x = 0;
y = 0;
for (i=0; i<36; i++) {
attachMovie("Card", "Card"+i, i);
_root["Card"+i].picture = cardsListSorted[i];
_root["Card"+i]._x = x*60+200;
_root["Card"+i]._y = y*60+50;
// move to next card spot
x++;
if (x>5) {
x = 0;
y++;
}
}
firstclip = 0;
}
function clickCard(clip) {
// see if two card are showing
if (secondclip != 0) {
// turn those two cards back over
firstclip.enabled = true;
secondclip.enabled = true;
firstclip.gotoAndStop(1);
secondclip.gotoAndStop(1);
firstclip = 0;
secondclip = 0;
}
// see if same card was clicked
if (firstclip == clip) {
// turn card back over
firstclip.gotoAndStop(1);
firstclip = 0;
// see if no cards are showing
} else if (firstclip == 0) {
// turn first card over
clip.gotoAndStop(clip.picture+1);
firstclip = clip;
firstclip.enabled = false;
// must be one card showing
} else {
// turn second card over
clip.gotoAndStop(clip.picture+1);
secondclip = clip;
secondclip.enabled = false;
// see if two cards match
if (firstclip.picture == secondclip.picture) {
// Disable both cards
firstclip.enabled = false;
secondclip.enabled = false;
firstclip = 0;
secondclip = 0;
}
}
}
When set to FlashPlayer5, all works well. If a player tries clicking the same tile twice, it stops them. Also, when a pair of tiles are uncovered, again, the user is no-longer able to press them. This was done using the "enabled = false".
However, when I change it to Flash Player 8, none of these seems to work. Ill include the .fla so someone could possibly play around with it and see where the problem is, or whether there is another way to do it....
Hope someone can help.
Many thanks
Swf Actionscript 3, Load A Actionscript 2 File.
Hey dudes.
I need some help over here:
i have one banner player, and load some external swf files in actionscript 2, but the player is actionscript 3.
The files is loaded like a movie, when load a as2 files into as3. I just need a trigger when the swf file ends, when is in the last frame of movie.
Someone have a ideia in how do that?
thanks!
Urgent :Getting Actionscript To 'pause' - Actionscript 2.0
Hi guys,
I need the actionscript to carry out a piece of code, then pause for 0.5 seconds, then carry out the next piece of code, then pause, then next code e.t.c
There will be twenty pieces of code that build up an animation with tweens that need to start at different times.
I guess its something to do with setInterval, but I'm not sure on the syntax, as there 20 pieces of code I don't want lots of nested code (though if thats the only way to do it then so be it!)
I'd really appreciate your help guys
cheers
Obtaining An ActionScript 2 Variable From ActionScript 3
Probably one of the most subjects on this forum has to be ActionScript 3 and ActionScript 2 communication. I found several threads on how to communicate between the two using a LocalConnection class, but there is one problem with this approach - I can't transport any values with it. Because LocationConnection.send doesn't have a return type, there is no way to transport a value from AS2 to AS3. This is very unfortunate, as I need to have access to a value that is set somewhere in the AS2 code.
I could use JavaScript as a middle layer to communicate the data between the two, but this will be a very ineffective way to achieve it. Are there any better ways for doing this?
ActionScript 3.0 Is 5~7 Times Slower Then ActionScript 2.0
I have a code that will translate this XML
quote:
<?xml version='1.0'?>
<Member>
<M>
<Username>Test 1</Username>
<Password>Test 1 Password</Password>
</M>
<M>
<Username>Test 2</Username>
<Password>Test 2 Password</Password>
</M>
<M>
<Username>Test 3</Username>
<Password>Test 3 Password</Password>
</M>
</Member>
Into this array
quote:
Array[0].Username = "Test 1"
Array[0].Password = "Test 1 Password"
Array[1].Username = "Test 2"
Array[1].Password = "Test 2 Password"
Array[2].Username = "Test 3"
Array[2].Password = "Test 3 Password"
Here is my variable declaration
quote:
var StartTime:Number = getTimer();
var EndTime:Number = getTimer();
var j:Number = 0;//This Variables used for ActionScript 3.0 Loop
var k:Number = 0;//This Variables used for ActionScript 3.0 Loop
Here is the XML String
quote:
var MyXMLString:String = "<?xml version='1.0'?><member><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O></member>";
var MyXML:XML = new XML(MyXMLString);//Parse the XML ONCE
I have a function called ConvertXML , and to check the performance i made it loop every frame by calling the following RunXML function
quote:
function RunXML(Events:Event){
StartTime = getTimer();
for(var i:Number=0;i<100;i++){
var MyXMLArr:Array = ConvertXML(MyXML, false, false);
}
EndTime = getTimer();
trace(EndTime - StartTime + " ms");
}
and here is my code for parsing the variable MyXML in ActionScript 3.0 (ConvertXML function)
quote:
//Action Script 3.0 ConvertXML
import flash.xml.*;
function ConvertXML(RecvXML:XML, ChildBranch:Boolean, IsTable:Boolean):Array {
var RowArr:Array = new Array();
for (j=0; j<RecvXML.child("*").length(); j++) {
var TempObject = new Object();
for (k=0; k<RecvXML.child("*")[j].elements("*").length(); k++) {
TempObject[RecvXML.child("*")[j].elements("*")[k].name()] = RecvXML.child("*")[j].elements("*")[k];
}
RowArr.push(TempObject);
}
return RowArr;
}
addEventListener(Event.ENTER_FRAME, RunXML);
The code above run 5~7 times slower then the following actionscript 2.0 code
quote:
//Action Script 2.0 ConvertXML
function ConvertXML(RecvXML:XML, ChildBranch:Boolean, IsTable:Boolean):Array {
var RowArr:Array = new Array();
for (var aNode:XMLNode = RecvXML.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) {
var TempRecord:Object = new Object();
for (var bNode:XMLNode = aNode.firstChild; bNode != null; bNode=bNode.nextSibling) {
TempRecord[bNode.nodeName] = bNode.firstChild.toString();
}
RowArr.push(TempRecord);
}
return RowArr;
}
this.onEnterFrame = RunXML;
they both does exactly the same thing.. and yet the actionscript 3.0 code run 5~7 TIMES SLOWER . why?
i have tried other benchmark, and it seems that actionscript 3.0 perform 10 to 100 TIMES FASTER then actionscript 2.0 , only for this one it run slower... why?
I also attach all the code for actionscript 3.0
should you want to try the actionscript 2.0 , just uncomment the ConvertXML and this.onEnterFrame for actionscript 2.0 and comment the one for actionscript 3.0
Why? have i done something wrong?
Cheers and God Bless,
Chowi
Attach Code
var StartTime:Number = getTimer();
var EndTime:Number = getTimer();
var MyXMLString:String = "<?xml version='1.0'?><member><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O></member>";
var MyXML:XML = new XML(MyXMLString);//Parse the XML ONCE
var j:Number = 0;//This Variables used for ActionScript 3.0 Loop
var k:Number = 0;//This Variables used for ActionScript 3.0 Loop
/*
//Action Script 2.0 ConvertXML
function ConvertXML(RecvXML:XML, ChildBranch:Boolean, IsTable:Boolean):Array {
var RowArr:Array = new Array();
for (var aNode:XMLNode = RecvXML.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) {
var TempRecord:Object = new Object();
for (var bNode:XMLNode = aNode.firstChild; bNode != null; bNode=bNode.nextSibling) {
TempRecord[bNode.nodeName] = bNode.firstChild.toString();
}
RowArr.push(TempRecord);
}
return RowArr;
}
this.onEnterFrame = RunXML;
*/
//Action Script 3.0 ConvertXML
import flash.xml.*;
function ConvertXML(RecvXML:XML, ChildBranch:Boolean, IsTable:Boolean):Array {
var RowArr:Array = new Array();
for (j=0; j<RecvXML.child("*").length(); j++) {
var TempObject = new Object();
for (k=0; k<RecvXML.child("*")[j].elements("*").length(); k++) {
TempObject[RecvXML.child("*")[j].elements("*")[k].name()] = RecvXML.child("*")[j].elements("*")[k];
}
RowArr.push(TempObject);
}
return RowArr;
}
addEventListener(Event.ENTER_FRAME, RunXML);
function RunXML(Events:Event){
StartTime = getTimer();
for(var i:Number=0;i<100;i++){
var MyXMLArr:Array = ConvertXML(MyXML, false, false);
}
EndTime = getTimer();
trace(EndTime - StartTime + " ms");
}
Edited: 10/09/2008 at 12:17:57 AM by M4G1C14N
|