Flex Doozie Of A Bug
Short version of the question, for those disinclined to reading: Under what circumstances could one display object be inside a Canvas, with non-zero height and width, alpha of 1, visible == true, have the highest myCanvas.getChildIndex() value, etc. etc. and still not be rendered onscreen (or respond to the mouse) even when other display objects inside the canvas are rendered correctly?Moreover, under what circumstances could this happen only about 50% of the times the program is run, while working correctly the other 50% of the time after the same sequence of user actions?Long version of the question:I'm working on a Flex engine for browser-based point-and-click adventure games. It takes a game.xml file and parses it, along with a directory of graphic resources, into something along the lines of Submachine, though a bit more sophisticated.I've run into a bug that I probably could just work around and get my game running... but I anticipate that others may eventually make games using my engine, so I'd like to actually squash the bug itself.The game's Rooms can contain RoomObjects and Exits. All of those (Room, RoomObject and Exit) extend Canvas. When the player moves to a new room, the old Room is removed from the game's main Canvas, and the new Room is added.The bug occurs when a player's actions in one Room cause an Exit or RoomObject to be added to a different Room that the player has already visited. When the player returns to that room, the Exit or Object is rendered correctly about 50% of the times the program is run, and 50% it isn't (even if the player tries leaving and coming back). Things like trace(Room(myObject.parent).name); and trace(myObject.visible); all give responses that indicate that everything has gone as planned and the object should be visible onscreen... it just isn't.I've tried calling things like validateNow() on the object, the room, the application, etc... nothing works.When an Exit or RoomObject is added to the player's current Room, it works 100% of the time. Likewise, when adding an Exit or RoomObject to a Room the player has not yet visited, it works 100% of the time.Thus, I suspect it's some kind of caching problem... the Flash player is remembering the Room the way it was the last time the player visited, and doesn't realize that something new has been added since then. The question is, how do I force it to refresh?Help!
KirupaForum > Flash > ActionScript 3.0
Posted on: 09-02-2008, 07:41 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamic Text, This One's A Doozie
I have several text files that are loaded into a clip based upon a button that's being pushed. All the text files are 1KB and work just fine, with the exception of one, which is 8KB. For some reason, this particular file isn't being loaded when the button is clicked as the others are. Oddly enough, whatever last text file was loaded into the MC is what appears, if anything at all. Is this related to the size of the text file? Is there a limitation on that? It's only 8KB so it shouldn't make much difference, should it? The address is http://www.holtequipment.net if you'd like to check it out.
Thanks a mil!
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
Flex Displaying Labels/Text Vertically In Flex 3
Hi All,
I have a chart in Flex 3 and am currently displaying the axis names using <mx:Label! I want to display the vertical axis name vertically, that is
p
r
i
c
e
instead of
price
I was wondering if anyone knew how I might be able to do this? Any help really would be greatly appreciated!
Thanks,
Derm
Flex Drop Alternate Labels From A Flex Bar Chart
Hi,
I have a bar graph in flex. i need to show labels on the x axis only after a definite intervals. actually this is to avoid overlapping of labels. for eg. if it is the 12 months shown on x axis, i need to show Jan April July etc. instead of Jan,Feb,March,April etc.
Any help would be appreciated.
Thanks
Ananya.
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.
Flex Flex 3 Update 2 ( AS3 ) And Visual Basic 2008
Hello i am newbie for your forum . A lot of thanks for welcome.
I would to know about Flex and Visual Basic 2008 ( 9 Version with SP 1 ) because it is different with "fscommand" or "externedinterface.call"
I know that adding with shockwave in Visual Basic 2008 like old version of using object.
http://www.kirupa.com/developer/mx/flashvb.htm
But it is old version! I am using Visual Studio 2008 Pro with Service Pack 1 ...
I want to create swc with externedinterface or fscommand like MDM Zinc 3.x or Rapid applications...
Can you say me when your simple example for code?
I want to know:
- How do i exit an Application from Visual Basic 2008 while i click with externedinterface by Flex-Application.
Edit:
Flex Builder 3: Code:
Code:
<?xml version="1.0" encoding="utf-8"?><mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"><mx:Script>
<![CDATA[
publicfunction myAppexit():void
{
fscommand("vb_exit", "");
}
]]>
</mx:Script>
<mx:Button label="Exit" click="myAppexit()" left="10" top="10"/>
</mx:Application>
Visual Basic 2008: Code:
Code:
Public
Class Form1PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
AxShockwaveFlash1.Movie = "C:Dokumente und EinstellungenSnakeMediaEigene DateienVisual Studio 2008ProjectsWindowsApplication1WindowsApplication1myApp.swf"
EndSub
PublicSub AxShockwaveFlash1_FSCommand(ByVal command As System.String) Handles AxShockwaveFlash1.FSCommand
Application.Exit()
EndSub
End Class
2 Errors were outputs.. i can not try.. Please answer me for help!!
Thank you.
Best regards, SnakeMedia
Develop FLEX Applications, Without Purchasing FLEX Server
BIG news today, Mike Chambers has announced that the next version of flexbuilder (codenamed zorn which will be an eclipse plugin) will be able to compile mxml and Actionscript files into swfs, without having the flex server. There will still be things that you need flex server for (enterprise level features, no word on what these are just yet) but you wont need it for most of your flex swfs. This is a HUGE deal btw.
You can see the post here: http://weblogs.macromedia.com/mesh/a...zorn_requi.cfm
make sure you read through the comments, esp. my question and his answer.
[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
Flex Flex Tile List Component
How to make the Flex Tile list component scroll the content continously like in Scribd ? The tile list does not scroll continuously, but it abruptly jumps and fits the content place holders in the viewable area.
Flex Dynamic DataGrid Creation In Flex 3
Hi All
Can anyone please suggest me a way to create a data grid dynamically in Flex 3.(I actually was want to create it thru Action Script.)
The data would come from the XML and the rows of the grid are also not going to be fixed. It will be dependent on the number of nodes in the XML.
The data grid will have 3 columns 1 containing a text field, and the rest 2 will contain small icons, all created dynamically.
It would be gr8 if some code related to that can be provided.
Thanks for any help that can be provided.
Vicky
Flex RawChildren Ruins Layout In Flex 3
Hey all!
I've been playing around with Flex lately, and having come from a pure AS3 background, I couldn't help but create some simple effects in there for fun. That's when I hit a snag. Now, with Flex, I'd have to use the UIComponents' rawChildren object in order to add widgets of DisplayObject types... fair enough. Problem is when I do that, the components stop obeying layout rules, transitions stop working, etc.
The best way to really demonstrate this problem is to see the project itself. Here's a link to the project source:
http://www.thurinusworks.com/public/problem_src.zip
In there I created a Panel component that has view states and transitions, and an Application that holds that Panel and houses a bit of actionscript to create a sparkly mouse toy effect. If you commented out all the script for the mouse toy, you'll see that the Panel centers on the Application as you resize the window, and clicking the 'Register' link would display a nice elastic transition effect between view states. When the mouse toy is active, the Panel position stops working correctly, and clicking on the 'Register' link would simply display the view state with no transition. It happens intermittently, but seems to guarantee happening after the first SWF launch, so if you don't see it happening, relaunch the SWF and it should screw up.
I don't know what's causing it to break like this. It's either my error or a serious bug in Flex, and I dearly hope it's the former... If it is, what must I do to fix it? If it isn't, is there a work-around?
Thanks for *any* help you can provide!
Best regards,
Jay
Flex Filling Non-Flex Objects In A Repeat
Filling non-Flex objects in a Repeat
Hi guys,
For our current project were trying to put as much as possible of the display list structure into mxml. Because that's more readable.
This of course also includes using Repeat's for dynamical parts.
But, we build some parts in Flash. Just little peaces for skinning.
(We publish those as swc and use them in Flex)
We can't of course just use this in flex, but we have the DisplayObjectWrapper from Mr. Grant to fix that.
But despite of this wrapper I can't change the properties of non-Flex components within a Repeat, in mxml.
A simple example:
HTML Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:text="flash.text.*"
xmlns:ui="com.gskinner.ui.*">
<mx:Script>
<![CDATA[
[Bindable]
public var texts:Array = ["a","b","c"]
]]>
</mx:Script>
<mx:Repeater id="r" dataProvider="{texts}">
<ui:DisplayObjectWrapper>
<text:TextField text="{r.currentItem}" />
</ui:DisplayObjectWrapper>
</mx:Repeater>
</mx:Canvas>
This gives the (compile) error:
"Unable to generate initialization code within Repeater, due to id or data binding on a component that is not a visual child."
I went searching but couldn't find much. Only that you can get this error if you use the DataGridColumn in a certain way in a Repeat.
Anyone any idea how to get this working?
Thnx
Flex How To Connect Flex App (View) To Controller
I have a Flex app with a centralized event controller. What's the best way to connect the app to the controller? Right now the View instantiates an instance of the Controller but the controller isn't aware of the view.
Flex How To Change The SWF I Have Loaded In Flex During Runtime.
Guys
I have a Flex application in which i have a SWF loader which loads a swf from an external Actionscript project.
I want that SWF file (from External AS project) to be modified when the user does some operation on the main Flex Application.... I mean i have to create some other objects on that SWF file.
Please help guys...
thanx in advance..
FLEX Rocks [would Like A Flex Forum]
This awsam new technology will deffinitely change the web programming!
So I think it deserves it's own forum.. ;-)
Flex Example Applications: http://www.adobe.com/devnet/flex/ind...?tab:samples=1
I did a little testing - and I am amazed with every single thing that I discover!
Integration of your custom Actionscript 3 classes is great (link: my background test).
Running A Flex App Outside Flex Builder
Hi all,
I've been working on a flex widget for a number of weeks and have just completed development and testing and want to upload the swf to a server! If I run the swf from flex builder it connects to the server fine and runs through the entire operation!
However if I try and run the swf from anyother location (I've only tried off a folder in my c drive and my desktop) I get an error connecting to the server?
Does anyone have any ideas why this is happening or more likely what I'm doing wrong? I'm copying the swf from the bin folder in flex builder and then pasting it to a seperate location and trying to run it! It runs fine by double clicking on it in the bin folder but won't run anywhere else??
Any help would be greatly appreciated!!
Thanks in advance,
Derm
Flex Flex Button Question
Very basic question for the flex people.
How do you get rid of that very annoying blue rect round a button when you roll over it ?
I've tried about every style property in the Flex doc.
Flex I Need A Window Class In Flex
Hi ! I'm trying to make an application with windows. I want to load buttons, text, pictures, etc in each window. and i want to let the user move the window, close it ... maybe resize it and maximize/minimize it ... And the most important: It must have scrollBars. Because my content might be larger than the Window.
Now ... i am using Flex and it has some nice classes but i didn't found anything like what i was thinking about. For example the mx.containers.TitleWindow is a nice window that has a close button and i can easily add Children to it, it has that scrollBar ... But i can't move it, i can't resize it ...
Do you know any class? Or should i make a new one that extends the TitleWindow? and add the things i want ?
Flex 2nd Flex RIA - QuickView Portfolio
I'm in the process of learning Flex and MXML. I decided to make a mini site to show off my work. All created in Flex Framework. CHec out more here. Give me your opinions, Thanks
http://blog.kreativeking.com/2009/01...lio-mini-site/
Free Flex 2 SDK Or Flex Builder 2
Am i correct in thinking you can only go so far with the Free Flex 2 SDK? And if you want to build something serious and efficiently you need buy stuff i.e Flex Builder?
I don't want to sound stingy and am quite prepared to pay for authoring tools. But don't want to buy things I don't need.
Do You Use Flex SDK (without Flex Builder) ?
Im hesitant whether to buy Flex builder, and I want to make this step from flash to flex. The flex SDK is free, but I do not quite understand how exactly to work with it. It is basically a set of functions I can use, and a compiler? Anyone worked with it, and can refer me to a tutorial, for a helloworld application or something?
Thanks
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.
What Is Flex?
I've been seeing alot about this lately. But anytime I try and look it up I just find... "Flex is use to make rich web content blah blah..." Which is kind of a generic response.
So what is it specifically? Is it an XML and Actionscript framework or is it just a program? How is it related to flash?
Flex 2
Greetings All:
My question is how do I change or choose what player I want when using Flex? each time I run my project in flex It says it can't find flash player 9 and reloaded it twice already.
Flex 3
Greetings:
I am using Flex 3 and I created a form and I'm trying to get a submit and reset button to work. I put both buttons inside the form and now I need the right codes to get it to work. This is what I have in the current code
<mx:Button label="Submit" enabled="true" click="submitFormevent)" id="sm"/>
<mx:Button label="Reset" enabled="true" click="resetFormevent)" id="re"/>.
Using Flex UI In AS3
I wrote up a simple tutorial on how to get started on using the Flex UI components from within Actionscript 3 cause it took me forever to figure out how to do it myself. Thought maybe someone else could benefit from it.
http://willperone.net/Code/as3ui.php
What Is Flex? (k)
Please don't send me to the Adobe site. I've been through the
explanation there and still don't get it.
http://www.adobe.com/products/flex/
Is flex a means to pull data from a mySQL database into Flash? Is it
something completely different?
Does a web server need to be configured to us Flex?
We are web designers here who use Dreamweaver and Flash daily, but
rarely venture in to the database dynamically driven website world. We
farm that stuff out.
One of my employees wants to take a class in Flex. I just want to be
sure we get some sort of return on that investment.
-Kirk
Flex Vs AS3
Hi,
I have a potential project in AS3, or Flex. It is a data driven web application for sorting and displaying images. Images are retrieved from an image server. Some filtering is required, to keep load times down.
I have enough experience in AS3 to be confident that I could do it in AS3, (I would hire and consult a more experienced AS3 person for guidance on some of the high-risk features). The client has asked me if I could do it in Flex, if needed. My inclination is to say no, since I haven't worked in it. He is on a timeframe of about a month, which seems reasonable if I was to do it in AS3. So here are my questions:
-why would he ask me to do it in Flex? (I don't know the advantages of Flex)
-if you've learned Flex, after you knew AS3, how brutal was the learning curve?
Lots of vague information, I know, but any comments would be most appreciated. Thanks
Edited: 08/06/2008 at 01:21:57 PM by dmodie
What Is Flex?
Alright,
I've heard it said that Flex was designed to make more money... What is Flex and what does it do that Flash can't do? Why, ultimately, would a company spend money on such a program?
Cf, Flex, ?, ?
This is a weird question, but I wanted to know if anyone had any idea what would come after FLEX, as far as a site development tool. I mean, what are the NEXT advanced web application tools.
Any clue will be greatly appreciated.
JH
What Exactly Is Flex
So there's so much buzz recently on Flex as well as Ruby on Rails? Can someone tell me what they are?
I heard Flex was similar to Flex, how are they different?
Thanks.
Air, Flex ?
Hi,
I'm designing an interface for a series of touch screens based on a pocked pc platform, they pick their content up via an XML feed.
I'm confused by the difference between standard flash, adobe Flex and Adobe air.
Whats the differences and which would be best?
Thanks!
Flex CSS
I'm just trying to apply some CSS to my Flex app and just trying to get my head around it.
Say I had:
Code:
<mx:Canvas id="contentContainer" x="0" y="0" width="320" height="390"></mx:Canvas>
Do I apply the CSS like so (in an external stylesheet):
Code:
#contentContainer { ... }
Flex Flex
i'm sorry if this isn't the right place to ask this. but i couldn't find a better one.
So i was thinking about learning Flex but...I downloaded Flex and created a new Action Script Project. A package was created for me, and a class ... and ... well a constructor function...and i was able to create sprites ... and draw something with Sprite.graphics but then i wanted to add a button to my application, or any component. So since i am used with Flash CS3 i tried to import the Button class so i said import fl.controls.Button; but i could see the hints. In flash CS3 there were 2 big packages fl and flash. now there are 4:adobe, com, flash, mx ?? where is the fl class? where are the buttons?
-------
My second question. If i create a Flex Project i get a .mxml file and if i switch to the Design mode then i have in the left all the components from flash CS3 and even more. That's great ... but ... guys .. when i add a button to my stage ... in the Source tab i get a new line <mx:Button x="231" y="68" label="Button"/> uhm ... that's not AS. if i have a .mxml file ... can i write AS3.0 code? can i write AS code in Flex projects? or these are different languages? I mean... if i want to use the other components that flex has ... and use everything that flex has and Flash hasn't ... do i have to learn a new programming language ... or i sill can do the buttons in the old way :
Code:
var btn:Button = new Button();
btn.label = "My Button";
addChild(btn);
//btn.addEventListener .... and so on
Any tutorials for flex?
Thank you
Php Into Flex
I'm new to using flex and I've tried a number of ways to bring in some php data into a project of mine with no success. I did not write the php code, but from what i know it gathers data and puts it into a csv. The value I'm trying to extract first is "Station Name".
What I have now in my code is:
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:esri="http://www.esri.com/2008/ags" creationComplete="aTempData.send()">
<mx:HTTPService
id="aTempData" url="http://beta.glos.us/get_obs.php?observation=air_temperature"/>
<mx:DataGrid id="aTempDataGrid" dataProvider="{aTempData.lastResult}">
<mx:columns>
<mx:DataGridColumn headerText="Station Name" dataField="Station Name"/>
</mx:columns>
</mx:DataGrid>
the data grid appears with a label, but no data in the columns. I feel like I've tried everything and can't seem to move forward.
Any tips or suggestions would be great.
Flex Mx
Hi,
I am beginning to use Flex to build some online applications and I am wondering is there anywhere that I can learn all about the <mx: tags as I am struggling to find any decent information regarding what they do, how to do something etc.
Is there like a msdn or libary regarding the MX tags?
thanks for looking
Al
Help Me In Doing Flex
hello all,
i have got action script class for red eye removal for an image,
can anyone tell me how to use these functions in mxml?please help me.
import flash.display.BitmapData;
class RedEyeReducer{
//Ben Pritchard 2005
//Bitmap Data Object
private var pBMP:BitmapData;
//Input Mc
private var mc:MovieClip;
//Tolerances
private var toleranceRed:Number;
private var toleranceGreen:Number;
private var toleranceBlue:Number;
function RedEyeReducer(){
}
//Apply tolerances
public function setColorTolerance(r:Number,g:Number,b:Number):Void{
toleranceRed = r;
toleranceGreen = g;
toleranceBlue = b;
}
//Sets the mc to use for reduction
public function setPictureClip(mc:MovieClip):Void{
trace("MC " + mc);
mc.cRef = this;
//Creates the overlay
mc.createEmptyMovieClip("shade_mc", 2);
//Track the click and drag
mc.onPress = function(){
this.shade_mc.moveTo(this._xmouse, this._ymouse);
this.origX = this._xmouse;
this.origY = this._ymouse;
this.drawing = true;
}
//Redraw the overlay
mc.onMouseMove = function(){
if(this.drawing == true){
this.shade_mc.clear();
this.shade_mc.moveTo(this.origX,this.origY);
this.shade_mc.beginFill(0xFFFFFF,50);
this.shade_mc.lineTo(this._xmouse, this.origY);
this.shade_mc.lineTo(this._xmouse, this._ymouse);
this.shade_mc.lineTo(this.origX, this._ymouse);
this.shade_mc.lineTo(this.origX, this.origY);
this.shade_mc.endFill();
}
}
mc.onRelease = function(){
//Record the coordinates
this.endX = this._xmouse;
this.endY = this._ymouse;
//Clear the overlay
this.shade_mc.clear();
//Turn the overlay updating off
this.drawing = false;
//Create the bitmap object
var transparent:Boolean = true;
var fillColor:Number = 0xFFFFFFFF;
this.cRef.pBMP = new BitmapData(this._width, this._height, transparent, fillColor);
this.cRef.pBMP.draw(this);
this.attachBitmap(this.cRef.pBMP,1);
//Call the reduction method
this.cRef.setRedtoBlack(this.origX,this.origY,this.endX,this.endY);
}
}
private function setRedtoBlack(origX,origY,endX,endY):Void{
//Loop through the coordinate colors
trace(toleranceRed);
for(var i:Number= origX;i< endX;i++){
for(var j:Number = origY;j < endY;j++){
if(parseInt(pBMP.getPixel(i,j).toString(16).substring(0,2),16) > toleranceRed && parseInt(pBMP.getPixel(i,j).toString(16).substring(2,4),16) < toleranceGreen && parseInt(pBMP.getPixel(i,j).toString(16).substring(4,6),16) < toleranceBlue){
var currentColor = "0x" + "00" + pBMP.getPixel(i,j).toString(16).substring(2,6);
pBMP.setPixel(i,j,currentColor);
}
}
}
}
public function reset():Void{
pBMP.dispose();
}
}
thanks
Flex And Php
I have read a lot that you need to use xml or amfphp etc to communicate with your php pages in flex but I found the following in a blog by Nitin Gore where he doesn't do that. I was wondering if someone could explain how and why this works.
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="fnCreationComplete()">
<mx:HTTPService id="Sum_HttpServ" url="http://yourDomain/someFolder/GetSum.php" result="fnDiplayResult(event)" fault="fnHandleFault(event)"/>
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
private function fnCreationComplete():void{
var Obj:Object=new Object();
Obj.num1=2;
Obj.num2=5;
Sum_HttpServ.method="POST";
Sum_HttpServ.send(Obj);
}
private function fnHandleFault(event:FaultEvent):void{
Alert.show("Error ID="+event.fault.errorID+" faultString="+event.fault.faultString);
}
private function fnDiplayResult(event:ResultEvent):void{
Alert.show(event.result.toString());
}
]]>
</mx:Script>
</mx:Application>
and the php is
Code:
<?
$Number1=$_POST['num1'];
$Number2=$_POST['num2'];
print ($Number1+$Number2);
?>
Does Anyone Know Anything About Flex?
Hello,
There's no macromedia flex forums on this site, was wondering if anyone reading this happened to know much about it. If you do, do you have any information on how to connect to a database with flex?
Flex Seems To Be The Key...
Okay, I'm sure all of us web designers have heard of macromedia flex and what all it can do it what it cant do. Has anyone tried compiling the mxml files into an SWF with mxmlc on the command line? My problems seems to be that whenever I compile the mxml file into an SWF the SWF file is 0 bytes. I was wondering if anyone else has had this problem or not? I've done almost everything that the macromedia website said to do in the manuals containing mxmlc. Any help would be appreciated.
FLEX Revolution ?
FLEX is a presentation server for a new generation of Rich Internet Apps.
It is based on MXML - XML-based markup language.
You can read more about it here.
It looks quite interesting to me..
What do you guys think about it? Share your predictions and ideas please
Help REQ: Flex Mesh
Hey everyone,
Brand new member, self-educating flash programmer, and experimentation enthusiast.
The easiest way to explain what I am trying to accomplish is to show it to you. I've attached a screen capture of a demo app of the same concept that I recently wrote in VB6. It works well and runs in realtime.
In ActionScript terms, each point instance in the grid (where two lines intersect) is actually a MovieClip in an array called "gPoints." The size of the array is determined by the value of the global variable "gDim" squared. So, if gDim's value is 9, the size of the array is 9^2 or 81.
The grid could be defined in the following function:
Code:
gridSetup = function() {
var i_number; // dominant iteration in a compound for... loop
var j_number; // subordinant iteration in a compound for... loop
for(i_number=0;i_number<Math.pow(gDim,2);i_number++) { // load points
gPoints.push(<MovieClip that behaves as point in grid>);
}
for(i_number=0;i_number<gDim;i_number++) { // define the vertical positions (rows)
for(j_number=0;j_number<gDim;j_number++) { // define the horizontal positions (columns)
gPoints[(i_number * gDim) + j_number].xPos = gMarginX_number + (j_number * gPtSpacing_number);
gPoints[(i_number * gDim) + j_number].yPos = gMarginY_number + (i_number * gPtSpacing_number);
}
}
}
This is a rough translation from VB syntax to AS syntax, and I'm not advanced enough to know if it's flawed beyond my pesudo-coded Array.push() assignment. Any improvements are welcome.
I wanted to make it possible to programmatically place the grid anywhere that it was needed, so I created the variables "gMarginX_number" and "gMarginY_number" to define it's starting position (upper-left corner.)
The app is setup to consider the grid's perimeter as a perfect square. With this in mind, the value of the variable "gPtSpacing_number" is equal to the length of any given side of the square (a global variable) divided by the difference of (gDim - 1), or:
Code:
var gPtSpacing_number = (gSide / (gDim - 1));
When the mouse moves around the screen, instances in the grid are only affected if their grid space locations are within a circle centered on the present location of the mouse pointer whose radius is defined by the global variable "mR." The location of the mouse is stored in the global variables "mX" and "mY."
Each MovieClip in "gPoints" has a bunch of local variables that are used to calculate its new location when the mouse draws close enough to affect it:
Code:
this.xPos; // the x-coordinate in grid space, this is never changed
this.yPos; // the y-coordinate in grid space, ditto
this.sideA; // Math.pow((mX - xPos),2), changes whenever mouse moves
this.sideB; // Math.pow((mY - yPos),2), ditto
this.sideC; // Math.sqrt(this.sideA + this.sideB), ditto
this.scalar; // (mR / this.sideC) - 1, ditto
The variables "sideA", "sideB", and "sideC" are used to employ the Pythagorian Theorum to determine whether or not a given instance in gPoints lies within the radius of affect "mR."
The rest is more complicated for me to explain, but the basic idea is that the variable "scalar" evaluates the percentage necessary to make the hypotenuse in "sideC" equal to the value of "mR", once "scalar" is applied to "sideA" and "sideB."
The actual subroutine I wrote in VB employs code structures whose ActionScript equivelants are too unfamiliar to me to permit an accurate translation of what is taking place, so here it is translated in verbatum structure but equivelant code:
Code:
var def_Aff_Dots = function() {
var i_number;
var j_number;
for (i_number=0;i_number<gDim;i_number++) {
for (j_number=0;j_number<gDim;j_number++) {
with gPoints[(i_number * gDim) + j_number]
this.sideA = Math.pow((.xPos - mX),2);
this.sideB = Math.pow((.yPos - mY),2);
this.sideC = Math.sqrt(this.sideA + this.sideB);
if (this.sideC>0) {
this.scalar=(mR / this.sideC) - 1;
} else {
this.scalar=0;
}
if (this.sideC < (mR + 1)) {
this._x = mX + this.sideA - ((((this.sideC - mR) / mR) * Math.atan(this.scalar)) * this.sideA);
this._y = mY + this.sideB - ((((this.sideC - mR) / mR) * Math.atan(this.scalar)) * this.sideB);
} else {
this._x = this.xPos;
this._x = this.yPos;
}
}
}
}
}
The routine above is performed between the moment the screen is cleared and a new frame is drawn. The only code I've omitted is the loop that draws all the lines between the grid points.
So, now that it's up for all to see, who here can tell me how to make it work? I've tried and failed so far. Feel free to use this "lens" effect in your stuff, just clue me in on how you made it work if you get it going.
Thanks,
+Q__
Flash Or Flex?
Is it possible to create Rich Internet Applications simply using Flash? I am thinking of delving into Flex but I don't think my apps would be nearly as complicated as their examples. As such, would Flash MX or MX Pro suffice?
|