I'm not clear you can use this sequence to startup a Flex app. You might be able to wire it in as a replacement for a downloadProgressBar.
You can make the main app dynamic by subclassing public dynamic class BrianApplication extends Application but I still don't think this is going to work. ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Brian Sent: Thursday, February 14, 2008 8:06 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: how to start with a dynamic actionscript class instead of mx:Application? Well, here's one of the classes from their API doc. I think it's an example, but I tried calling this in my preloader attribute in mx:Application and it errored with a null error on the loaderInfo.addEventListener line. I tried to put my main mxml file in the MAIN_CLASS. The properties look to be the 'id' and 'res', although there is an additional one for AS3, called 'clip' and from the examples it looks like it's supposed to be a MovieClip class. >From their docs, the important line appears to be the MochiAd.showPreGameAd(opts); near the end. They generate code for this based on your game and resolution, and tell you to put that in your 'main class' as they call it. Their generated code looks something like MochiAd.showPreGameAd(clip: root, id: "someHexString", res: "800x600"); Here's their example Preloader: package { import flash.display.DisplayObject; import flash.display.MovieClip; import flash.events.IOErrorEvent; import flash.utils.getDefinitionByName; // Must be dynamic! public dynamic class Preloader extends MovieClip { // Keep track to see if an ad loaded or not private var did_load:Boolean; // Change this class name to your main class public static var MAIN_CLASS:String = "Test"; // Substitute these for what's in the MochiAd code public static var GAME_OPTIONS:Object = {id: "test", res:"550x400"}; public function Preloader() { super(); var f:Function = function(ev:IOErrorEvent):void { // Ignore event to prevent unhandled error exception } loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f); var opts:Object = {}; for (var k:String in GAME_OPTIONS) { opts[k] = GAME_OPTIONS[k]; } opts.ad_started = function ():void { did_load = true; } opts.ad_finished = function ():void { // don't directly reference the class, otherwise it will be // loaded before the preloader can begin var mainClass:Class = Class(getDefinitionByName(MAIN_CLASS)); var app:Object = new mainClass(); parent.addChild(app as DisplayObject); if (app.init) { app.init(did_load); } } opts.clip = this; MochiAd.showPreGameAd(opts); } } } --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Johannes Nel" <[EMAIL PROTECTED]> wrote: > > try and find out what properties they are adding dynamically and implement > that interface > > On Thu, Feb 14, 2008 at 9:48 AM, Brian <[EMAIL PROTECTED]> wrote: > > > I've created a game with Flex, and now I'm trying to integrate > > MochiAds with it. They give you a preloader to use, but most of their > > documentation is actionscript-centric and oriented toward Flash > > developers and the Flash IDE. > > > > I tried using the preloader attribute of the mx:Application tag, but > > they told me that the 'main class' of the application has to be a > > dynamic class, which they said is impossible with MXML. > > > > Any idea how to do this? Seems like most of the Flex docs assume > > you're starting with an mx:Application tag as your entry point. > > > > I've asked on their developer forums as well but haven't gotten many > > details. > > > > Thanks > > > > > > > > > > -- > j:pn > \\no comment >