• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

flex 4

 
jp roberts
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will/can one use flex objects in a web page like one can use a dojo widget. Like just using a flex datagrid embedded on a web page and having the ability to communicate with it via javascript?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes and no. You can embed Flash applications in web pages, and Flex provides a mechanism (ExternalInterface) to interface with JavaScript running in the host page. But you can't embed the component directly, you need to embed an Application (though there is nothing to prevent the application just containug a DataGrid).

(NB: please UseAMeaningfulSubjectLine when posting)
 
Dan Orlando
author
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your DataGrid would be compiled to a SWF which would then be embedded via the html object tag. You can then use the ExternalInterface API (part of AS3) to communicate with javascript. Using this method, you can make direct calls to your JS methods, passing arguments, and assign callback functions. This is a bi-directional relationship that is initialized at runtime as well. In other words, the communication does not have to be initiated by Flex (the SWF). Its actually quite easy when you realize its just like one object talking to another, but each with their own API. Hope this makes sense.
 
Joel Hooks
author
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jp roberts wrote:Will/can one use flex objects in a web page like one can use a dojo widget. Like just using a flex datagrid embedded on a web page and having the ability to communicate with it via javascript?


One thing about Flex is the size of the framework in the embedded swfs. It is rather large. However, Adobe provides the framework in signed runtime-shared-libraries (RSL) that are cached by the Flash Player. This means that if the visitor has already cached the RSLs then they don't need to retrieve the framework. It makes your SWFs acceptable in terms of size. As Dan says, communicating with the SWF via the ExternalInterface is really easy. The SWF object is a first-class JavaScript citizen. You can do some really cool things this way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic