Tag Archive for 'Flex'

Simple Screen Size Notification in AS3

I have made a small class that you can use if you would like to do something when your flash player is scaled to a maximum or minimum  size. I have seen this used before where if the user scaled the browser to less then 1024×768 the user was warned to scales their browser to the correct size.

I have also added the ability to ignore all out of bound events with a simple method call.

Download Zip here
http://gfxcomplex.com/blog/wp-content/uploads/2008/07/screensizenotification.zip

Source comes with completed example file.

Heres some example useage

import com.gfxcomplex.screen_management.ScreenSizeNotification;

var testing:ScreenSizeNotification = new ScreenSizeNotification();
testing.manageStage(stage, {minSizeW:550, minSizeH:400, maxSizeW:1000, maxSizeH:850});
testing.addEventListener(ScreenSizeNotification.SCREEN_LESS_THEN_MIN, tooSmall);
testing.addEventListener(ScreenSizeNotification.SCREEN_GREATER_THEN_MAX, tooBig);

function tooSmall(e:Event):void{
	trace("Too small");
}

function tooBig(e:Event):void{
	trace("Too Big");
}
//if needed to stop event dispatches use testing.ignoreEvents(true);

(AS3 === AS3) = false! I am frustrated with the Flash vs Flex API’s and the bias of the community

What are the excuses for not allowing all that flex can do in flash or vice versa? I think AS3 should be AS3 not Flash’s AS3 or Flex’s AS3. I believe Adobe needs to address this big problem. We need a discrepancy free program language. The web community has become more bias to Flex over the last year with out concern for the developers working in Flash. Example Yahoo’s map API which works just fine in flash’s AS2 now is limited to flex in AS3 though with out any real under standing why.

From an IDE stand point what is the use of providing a IDE the power of AS3 only to limit it’s use? I want to know why Flex can do more then flash. From what I under stand the hole flex API is built off of the components built in flash. I think this bias for one IDE over the other with in the context of AS3 is setting the stage for failure and leaves a negative precedences in our community. I believe adobe needs to merge the two programs in to a single IDE or make a better attempt to bridge their discrepancy.

Wade Arnold’s new amfphp datagrid example at amfphp.org

amfphp.pnghttp://amfphp.org/docs2/tutorials/datagrid.html

Wade Arnold Amfphp.org has added a new example to adding a record set to a datagrid.

here’s the main document class: requires a datagrid component in the library.

// Wade Arnold: 1/16/2008
// Example is designed to show how to use amfphp to populate a fl.controls.datagrid.
// TODO: Add method to update the dataset array.
// TODO: Add an additional call that shows how to get data from a database.
// TODO: Add a method to update the database dataset. 

package {
	// required for flash file and output display
	import flash.display.MovieClip;
	import fl.events.*;
	import flash.events.*;
	// required to send/recieve data over AMF
	import flash.net.NetConnection;
	import flash.net.Responder;
	// required for the datagrid
	import fl.controls.DataGrid;
	//import fl.controls.dataGridClasses.DataGridColumn;
	import fl.data.DataProvider;

	// Flash CS3 Document Class.
	public class Main extends MovieClip {
		private var gateway:String = "http://localhost/amfphp/gateway.php";
		private var connection:NetConnection;
		private var responder:Responder;
		// DataGrid on the stage
		private var myDg:DataGrid;
		// Dataprovider for the DataGrid
		private var dp:DataProvider;

		public function Main() {
			trace("AMFPHP DataGrid Example");
			// Create the new dataprovider
			dp = new DataProvider();
			myDG.dataProvider = dp;

			// Responder to handle data returned from AMFPHP.
			responder = new Responder(onResult, onFault);
			connection = new NetConnection;

			// Gateway.php url for NetConnection
			connection.connect(gateway);
			// Ask for the data on the load of the flash file.
			connection.call("DataGrid.getDataSet", responder);
		}

		// Handle a successful AMF call. This method is defined by the responder.
		private function onResult(result:Object):void {
			// Add the data that was returned from ther service into the Dataprovider.
			dp.addItems(result);
			// Debug: Just showing how large the dataset is.
			trace("Rows Returned: "+dp.length);
		}

		// Handle an unsuccessfull AMF call. This is method is dedined by the responder.
		private function onFault(fault:Object):void {
			trace(String(fault.description));
		}
	}
}

Adobe coming to st.Louis for the pre release of Flex and Air.

James Ward from Adobe will be in St. Louis and the flex and fuse the arch user group has been selected to host their stay! Adobe is providing food and beverages, a free copy of Flex 3 (to be fulfilled after Flex 3 launches) and maybe some Flex schwag! This is a unique opportunity to talk directly with Adobe and learn all about Flex 3. Please plan now to attend this very important meeting! Let’s show Adobe what St. Louis has to offer.

Date: Thursday, February 7, 2008
Location: The Drive Agency, 1617 Locust, St. Louis Missouri
Time: 6:00 PM
Topic: Adobe is visiting!
Speaker(s): James Ward, Adobe Platform Evangalist Team

Go to http://flexandfusethearch.com/ for more info.