raigan
|
|
« on: June 11, 2010, 09:40:54 AM » |
|
What's the easiest way to author UI in Flash (i.e layout buttons/sliders/etc. to create menus) but load/use the UI in a FlashDevelop-based project? Is it possible to e.g define a button's OnClick() appearance in Flash, but the OnClick() behaviour (i.e callback function) in FlashDevelop? Is this crazy/stupid? Basically we have an old version of Flash and lots of existing menus/assets, and we want to use them in AS3 from FlashDevelop. Should we just spend the money on Flash Builder? Sorry if this is a stupid question, we're many years behind the curve in Flash it seems thanks, Raigan
|
|
|
Logged
|
|
|
|
|
raigan
|
|
« Reply #2 on: June 11, 2010, 10:36:54 AM » |
|
Sorry, I should have been more specific: we're not using any of the built-in UI components, they're our own movieclips. The CSS stuff seems like it only applies to standard components -- our stuff is all from a Flash 5 project Basically, right now we have e.g a movieclip that contains CallSomeFunc() on the 5th frame of its timeline. What we'd like to do is move all of that code into the FlashDevelop project, so that a button movieclip would contain only graphical elements, and we would dynamically load the button and then "inject" the code into the appropriate frame of the loaded movieclip. I suppose we could also just recreate our UI elements using the modern components. The main issue is that some of the buttons have e.g a complex animation on MouseOver, and it's unclear how you would set this up using CSS (which seems to just let you change a small range of colours/parameters rather than use completely different movieclips for each state of a button, which is what we'd need). thanks, Raigan
|
|
|
Logged
|
|
|
|
agj
|
|
« Reply #3 on: June 11, 2010, 01:08:06 PM » |
|
You can do it, sure, but I'm not sure how easy it would be to control everything from FlashDevelop, since objects become available and unavailable according to their position in the timeline. Checking the playhead's position could help for this, or calling a function from the timeline in Flash to trigger code in your Main class or whatever.
|
|
|
Logged
|
|
|
|
Aik
Level 6
|
|
« Reply #4 on: June 11, 2010, 07:08:41 PM » |
|
I think what you're looking for is embedded .swc files, but I'm not entirely sure that it will work the way you want it to.
|
|
|
Logged
|
|
|
|
John Nesky
|
|
« Reply #5 on: June 11, 2010, 08:11:43 PM » |
|
You can use CSS to set the background image of a standard MXML button to a Symbol/MovieClip of your choice, and you can set different Symbols for different states, i.e. Up, Over, Down, Pressed, Selected, Disabled, etc. Something like this: .myButtonStyle { upSkin: Embed(source='/MyAssets.swf', symbol='myUpSkin'); overSkin: Embed(source='/MyAssets.swf', symbol='myOverSkin'); downSkin: Embed(source='/MyAssets.swf', symbol='myDownSkin'); }
<mx:Button label="Hello" styleName="myButtonStyle" click="doThing()"/>
|
|
|
Logged
|
|
|
|
raigan
|
|
« Reply #6 on: June 12, 2010, 05:49:19 AM » |
|
You can use CSS to set the background image of a standard MXML button to a Symbol/MovieClip of your choice, and you can set different Symbols for different states, i.e. Up, Over, Down, Pressed, Selected, Disabled, etc. Something like this:
Oh, wow -- awesome! Thanks, that's perfect.
|
|
|
Logged
|
|
|
|
BorisTheBrave
|
|
« Reply #7 on: June 12, 2010, 05:54:33 AM » |
|
Does anyone seriously use mxml? I tried it, and it wasn't awful, but it seemed tricky to integrate into games. I think what Raigan's asking after is that he's used to playing code on the timeline, which you cannot do with FD. But yeah, there are reasonable alternatives. In particular, if you have buttons, you can put the same code in with myButton.addEventListener(MouseEvent.MOUSE_UP, ...);Also see SimpleButton, that let's you avoid a timeline for your button altogether. More advance timeline uses, you do start to miss, though.
|
|
|
Logged
|
|
|
|
John Nesky
|
|
« Reply #8 on: June 12, 2010, 09:01:19 AM » |
|
I use MXML professionally, but I could see how it might be overkill for an indie game.
|
|
|
Logged
|
|
|
|
raigan
|
|
« Reply #9 on: June 12, 2010, 10:46:50 AM » |
|
Basically we have a project made in Flash 5/AS1, and we're porting the code to FlashDevelop/AS3, but we aren't sure how to best manage all of the non-code elements, specifically the several screens of menus full of buttons. It's a bit of a mess.
|
|
|
Logged
|
|
|
|
nikki
|
|
« Reply #10 on: June 12, 2010, 12:32:02 PM » |
|
rather than use completely different movieclips for each state of a button, which is what we'd need but we aren't sure how to best manage all of the non-code elements, specifically the several screens of menus full of buttons. It's a bit of a mess i'm curious, what is it these buttons do ? why you need(ed) different movieclips and could a simple tilesheet solve alot of your problems ?
|
|
|
Logged
|
|
|
|
raigan
|
|
« Reply #11 on: June 12, 2010, 01:25:18 PM » |
|
i'm curious, what is it these buttons do ? why you need(ed) different movieclips and could a simple tilesheet solve alot of your problems ?
All we need them to do is call specific global callbacks when clicked, i.e ButtonClicked_NewGame(); the buttons have complex animations for some of their "mouse over" states. I don't know what a tilesheet is Thanks for trying to help everyone, sorry I'm so clueless!
|
|
|
Logged
|
|
|
|
st33d
Guest
|
|
« Reply #12 on: June 14, 2010, 02:59:46 AM » |
|
I think what Raigan's asking after is that he's used to playing code on the timeline, which you cannot do with FD. Has anyone played around with MovieClip.addFrameScript()? That's possibly how you could emulate timeline code. http://troyworks.com/blog/2007/09/22/as3-movieclipaddframescript/I'm currently importing assets from an swf compiled in CS3 so I can have MovieClips with assets on different frames. But unfortunately, the import process strips all code on all timelines. I haven't tried putting that code back with addFrameScript, but I didn't need to.
|
|
|
Logged
|
|
|
|
raigan
|
|
« Reply #13 on: June 14, 2010, 12:33:18 PM » |
|
Woo, this is another great solution, thanks! There's so much stuff in AS3 that I had no idea about...
|
|
|
Logged
|
|
|
|
John Nesky
|
|
« Reply #14 on: June 14, 2010, 12:36:11 PM » |
|
I'm currently importing assets from an swf compiled in CS3 so I can have MovieClips with assets on different frames. But unfortunately, the import process strips all code on all timelines. Importing movie clips only strips the code if the code was in AS1 or AS2. And Flash CS3 supports AS3, so if you have access to the original .fla it shouldn't be too hard to port it to AS3 and keep the code in the movie clip as-is. .addFrameScript() is certainly another option though.
|
|
|
Logged
|
|
|
|
st33d
Guest
|
|
« Reply #15 on: June 14, 2010, 12:51:26 PM » |
|
I'm embedding symbols from the swf. The docs say that all timeline code gets stripped in such a case, regardless of the actionscript version: http://livedocs.adobe.com/flex/3/html/help.html?content=embed_3.htmlI ran a quick test by putting a trace command on one of my clips timeline and no dice. I think that if you embed the whole swf you get the code intact.
|
|
|
Logged
|
|
|
|
grapefrukt
|
|
« Reply #16 on: June 14, 2010, 01:52:55 PM » |
|
or do a swc! it's better in pretty much every way.
|
|
|
Logged
|
|
|
|
|