Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
Spen #1
Screens. Where best to put actionScript
Hello I'm having a play with screens both form and slide based and so far these
are my concerns
1. There is very little documentation around which actualy looks at best
practices when building applications using forms. All the tutorials on the
macromedia site seem to delve streight into data binding using 1 or 2
components and don't really look at larger applications which may contain both
interactivity and animation
2. One of my main concerns is where to put actionscript when developing form
based applications. For example macromedia reccomended not putting any large
actionscripts on the time line and suggest using external scripts. Why is this?
I've also noticed that developers using screens are attaching actionscript to
buttons etc throughout their applications rather than compiling all their code
on the first frame of the timeline. This seems to be a step backwards as I
assumed good coding practice was to use call back functions etc on the 1st
frame of the movie or movie clip which gives the code a central location
3. I recently did a quick presentation using 35 slides each containing an
image. On one of the slides I needed to rotate the image which i did using
actionscript. However when I click on the image nothing happens for about 5
seconds then the image rotates. The code for this is on the first frame of the
timeline for that slide and uses an onEnterFrame function. Its not a big script
about 5 lines and it works fine in a normal timeline flash file
So I guess my question is how (or if) placing actionScript on the timeline of
a screen affects the performance of a screens based application. Particularly
when using loops and processor intensive onEnterFrame events for repetative code
Any Ideas
Spen Guest
-
navagating screens
I'm trying to get a button in slide1 go to a certain frame(61) in a slide 8, HOW???? Thanks... -
Working with Screens
Hello I'm doing a Web site using screens (Flash 2004 Pro) where each slide has a little animation which should play only when the screen is... -
Screens HELP
I don't know what is wrong I have a few screens. On one of them I have a button to which I add a behavour to hide this same screen. It doesn't... -
Screens for a picture
I work at a print shop and I was wondering if anybody has ever heard of screening a picture? It is were you lay dots over the screen and I understand... -
screens
Cees wrote: Don't worry about it. In my experience the X Window System installed by Woody does that about half the time. That's one reason... -
Ed Skwarecki #2
Re: Screens. Where best to put actionScript
The issue of best practices of where to put code is a thorny one and somewhat subjective.
A major motivating factor in building the screens feature, was in response to those users
for whom developing large applications using the timeline was cumbersome because doing so,
as you know, often results in "spaghetti" code that is hard to follow and hard to
maintain. Thus, we're generally recommending that folks put code in separate .as files
associated with a screen subclass. This encapsulation is more object oriented and puts
code in centralized locations, and seems to resonate more with folks who come from a more
traditional programming background (e.g. C++ or VB).
If you feel comfortable putting code on the timeline, or mixing screens and timeline
coding styles, that's entirely up to you. It really depends on who you expect to be
building and maintaining your code and what kind of app you're building.
As for the performance issues. There's nothing I can think of that would cause the delay
you're seeing. If you want to post it or a pared down example, I could take a look at it.
However, an easier way to do what you want might be to use the built in Transition
behavior for Rotate, attached to your slide triggered by an on(reveal) (or on(<whatever>)
you want.
--
Ed Skwarecki
Principal Architect
eLearning
Macromedia
Ed Skwarecki Guest
-
Spen #3
Re: Screens. Where best to put actionScript
Thanks for your time Ed
It's good to be pointed in the right direction, especially when your about to
completly change the way you approach Flash application development
With regard to the performance issues. I've uploaded the presentation I did to
the URL below
[url]http://www.smashingmedia.com/whatisdesig[/url]
On the 7th screen you are prompted to click on the image and rotate it. I
realize that this task could be acheived more easily using screen behaviours
however for future reference it would be handy to know if placing an
onEnterFrame event on the timeline of a screen causes performance problems in
large applications
Justi
Spen Guest
-
Ed Skwarecki #4
Re: Screens. Where best to put actionScript
I took a look at your sample. I saw that slide 7 has a noticeable lag before the rotation
begins. I tried recreating the same thing from scratch and my version starts immediately,
using onEnterFrame() to do the rotation. So I'm not sure why your example is showing the
delay, but it is not onEnterFrame in and of itself. Something else is interacting with
that to cause the delay. But without having the source .fla, it's hard to say what the
problem is.
--
Ed Skwarecki
Principal Architect
eLearning
Macromedia
Ed Skwarecki Guest
-
Spen #5
Re: Screens. Where best to put actionScript
I've done some more tests and it seems when the application gets too big it
becomes unresponsive. I've done a cut down version of the presentation (URL
shown below) which only uses 1 screen. The onEnterFrame works fine. As soon as
I add more screens with large images on them it slows down. Other than screen
behaviours for the transitions there is no other script in the original
presentation. I've attached the original source code for the cut down fla
showing the onEnterFrame code. The original presentation has 34 screens each
containing 1 image
cut down presentation: [url]http://www.smashingmedia.com/whatisdesign/wid.htm[/url]
original presentation: [url]http://www.smashingmedia.com/whatisdesign[/url]
Justi
Spen Guest
-
Ed Skwarecki #6
Re: Screens. Where best to put actionScript
I'm sort of stumped. When I try to recreate a movie with 35 large images, and use the
onEnterFrame() to rotate the image as you are doing, I don't see a delay.
Is it possible your preloader is somehow getting in the way? If you remove just the
preloader do you still see this latency?
Is it possible that some of your other slides have non-empty timelines? Remember, unless
the playHidden flag of a screen is set to false, all the slides will play at the same time
even if the slide is not showing.
--
Ed Skwarecki
Principal Architect
eLearning
Macromedia
Ed Skwarecki Guest
-
Spen #7
Re: Screens. Where best to put actionScript
It's not the preloader as this is contained in a seperate swf which loads the
presentation using attachMovie and removeMovieClip when the load is complete.
In any case I have the same problem when I test only the presentation movie in
flash.
The playHidden flag was set to true. However setting this to false on all the
screens had no effect. I also copeid and pasted all the screens into a new
document incase the file was damaged. This also had no effect.
I've uploaded the original presentation fla (13MB). If your interested, have a
look.
203.30.72.46/justin
Thanks for all your help on this. It's not that important that I fix this
problem as I've already done my presentation. I'm just curious to see if there
is a problem or if I'm doing something wrong so I can avoid it in future. I'd
really like to get my head around developing with screens however there is
little documentation which covers screens in detail. For example I recently
bought "Flash MX 2004 actionscript / training from the source". Its a very good
book however not a single mention of screens.
Justin
Spen Guest
-
Ed Skwarecki #8
Re: Screens. Where best to put actionScript
I took a look at the file. The lag is in the processing of the onRelease, not the
onEnterFrame. I have a pretty fast machine and there is a small but noticeable delay in
the response to the click when the other slides are present.
I suspect this has to do with how the player is doing mouse hit detection. I suspect it
has to sift through and "ignore" all the other slides which are there but invisible. I
don't have a good workaround for you. I'll keep poking around and let you know if I come
up with a better answer.
--
Ed Skwarecki
Principal Architect
eLearning
Macromedia
Ed Skwarecki Guest
-
Spen #9
Re: Screens. Where best to put actionScript
Thanks again for your time.
Can you recommend any books or tutorials which cover screens in detail?
Justin
Spen Guest
-
Ed Skwarecki #10
Re: Screens. Where best to put actionScript
For screens tutorials, etc, check out the Macromedia Dev Net section on screens:
[url]http://www.macromedia.com/devnet/mx/flash/screens.html[/url]
--
Ed Skwarecki
Principal Architect
eLearning
Macromedia
Ed Skwarecki Guest



Reply With Quote

