Archive for the 'Flex & Flash' Category

PDF2SWF - swf not showing up in the Loader component

nirav May 4th, 2006

I am facing a peculiar problem. Looks like it is a pdf2swf issue, I am pretty much frustrated with it. Posting it here to see if somebody can solve it!

I have pdf2swf installed on a Linux server. A user would upload a PDF file, pdf2swf converts that to swf and then we show it in a Flash app. We also show JPGs in the app - uploaded in a similar manner.

Now, the PDF is being converted to SWF successfully. If I load up the SWF in the browser, it shows up fine. But it does not show up in the Flash app.

We are using the Loader component in Flash 8. It does emit all the events of load progress, and also shows the event when the file has been completely loaded. Despite it being loaded completely, the swf does NOT show up in the loader.

I checked up for stupid mistakes I could make. Position of the content in loader, transparency, correct filenames, permission check - but everything seems to be in order. The same loader can easily load JPGs and other SWFs - the ones which are not created by pdf2swf.

I tried various options with pdf2swf command line - but none solved the problem.

I am stuck with this and would really like some help!

Can anybody throw some light on this?

FileReference - on Mac, type is not available

nirav April 29th, 2006

For doing file uploads with Flash, you have to use the FileReference class. Now it’s a really nice feature - provides the basic features for uploading files and tracking their progress. There are two things I want to note about it on this post.

1. When the file is uploaded from Mac, the “type” property is not available.
The FileReference class has a property “type”, that gives you the extension (with the dot) of the file. This is very handy to check file types and reject the ones you don’t want to allow. But when you upload a file from the Mac, the “type” property is blank. I am not sure if this is a Mac issue or a Flash issue. But as of now, the best way for you to find the extension of the file is to substr it.

var fName = f.name; // f is the FileReference Object
var ext:String = fName.substr(fName.lastIndexOf(”.”), fName.length);
ext = ext.toLowerCase();

2. You can’t return data from the server to Flash when upload completes
When you provide file upload feature in your application, many of the times, you want to return an ID of the uploaded file or its URL. The FileReference class does not support this. You have to make another call to the server to get any additional information. The FileReference will simply give you “onComplete” event when the server returns HTTP status code 200. It discards any data you send from the server in the response.

It would be great if we can pass a url encoded string back and the values were available to the onComplete event.

Flex 2 and IE 7 beta’s out

nirav February 1st, 2006

Macromedia / Adobe has released the beta of Flex 2. Flex is a superb way to build Rich Internet Applications. The Beta includes Flex Builder, Action Script 3, Flex Charting Components, Flex Enterprises Services and the Flash Player 8.5. Our experience with Flex has been very good. Flex will impact the way web applications are designed in a big way!

Microsoft too, announced the Beta 2 Preview of Internet Explorer 7. IE7 now has tabbed browsing, RSS support and a cleaner user interface. They did spend a lot of development time tightening the security as well.

I still love Firefox!

Datagrid editing and Flex

nirav January 30th, 2006

Do you know of a good resource that helps creating editable datagrids with Flex? Not with another text field where the user has to edit the text. The editing should happen in-place.

If there is a resource, great! Otherwise we will write up something. We have learnt a lot of things figuring out ways to do this ;-)

Unable to connect to endpoint - Flash Webservice problem

nirav January 28th, 2006

When you get “Unable to connect to endpoint” errors in Flash while using a web service, here are a few things you can check up:

  • If you are passing complex data, make sure you use classes on the backend. And not associative arrays.
  • If there is any problem on the web service, you may get this error. Test your service by writing a test case in the backend programming language (e.g. PHP) and see if that works.
  • Make sure the spelling of the function you are calling and the arguments to it are correctly written.
  • Did your first web service call succeed? If not, check the connection.

Next »