Applescript Studio With WebView Crashes When Pointed to YouTube Video

Hello all,

I am new to Macscripter posting, though I’ve read many a post in trying to learn Applescript, and have found the hints provided very helpful.

I am no creating an Applescript Studio project with XCODE 3.1.3 where I want to be able to view a URL that has an .flv movie embedded in the page. I am using the following code to load the page, and I do have webkit frameworks installed.

set URLWithString to call method "URLWithString:" of class "NSURL" with parameter "http://www.youtube.com"
		set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
		tell window of theObject
			set mainFrame to call method "mainFrame" of object (view "WebView")
		end tell
		call method "loadRequest:" of mainFrame with parameter requestWithURL

in the code about theObject is of course just the main window of the interface.

Now I’ve done a bit of debugging, so I know that it’s not purely a movie thing. I can point the browser to apple promotional videos on the apple store and those play just fine. And webpages load just fine too, even youtube.com loads fine.
But when I click on a video in youtube from the webview, or when I directly point the browser to a video, the page starts to load and then the application closes down, and the project shows that the “Application has exited with status 2”

Is this a limitation of the WebView class, do I need to embed some sort of .swf file in the project, or am I just missing something completely?

Any assistance would be greatly appreciated!