Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Site Design / September 2007



Tip: Looking for answers? Try searching our database.

A couple of Flash questions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lost in the North - 03 Sep 2007 02:50 GMT
I am totally new at flash and am very slowly learning and I am sure these are
basic questions.  However,  I do have a couple of questions (actually I have
many but will start with two ;-)
One is when I play my clip it keeps replaying over and over, even though I
think I have put "stop" at the end of it.  I changed it under "properties" and
where is says "sync" I have put "stop".  Should it be on "repeat" or "loop" or
am I completely in the wrong area to stop it?
Second question is that I have uploaded it to a site.  My goal is to have it
play just once and then automatically open the next page of her site without
clicking on anything.  Is there a way to do this?
Thank you so much for any help you can provide.
David Stiller - 03 Sep 2007 14:30 GMT
Lost in the North,

> One is when I play my clip it keeps replaying over and
> over, even though I think I have put "stop" at the end of it.

   What sort of clip are we talking about -- movie clip, audio clip, video
clip?

> I changed it under "properties" and where is says "sync"
> I have put "stop".  Should it be on "repeat" or "loop" or
> am I completely in the wrong area to stop it?

   Aha.  What you're seeing there is called the Property inspector, which
is probably the single most flexible control panel on the screen.  You'll
notice that the Property inspector changes as you select various objects on
the Stage:  select a text field, and you'll find properties that relate to
text fields only; select a movie clip, those properties will change to
settings configurable for movie clips only; and so on.

   The Sync property for audio clips determines how the audio plays as the
timeline's playhead encounters it during playback.  A Sync setting of Event
means the full audio clip will load into memory as the playhead enters that
keyframe.  Even if you tell the timeline itself to stop during the very next
timeline frame, the audio will continue until it runs out (and if you've
selected repeat or loop, it will repeat the number of times specified or
loop forever).  A Sync setting of Stream means that the audio clip is locked
in-step with the timeline that contains it.  If the full span of audio is 5
seconds, it might take 60 timeline frames to play it completely (assuming a
FLA framerate of 12fps, the default).

   The Sync settings Start and Stop do start and stop audio files, but my
hunch is that your whole Flash movie (the SWF itself) is looping, and that
you're confusing that with the starting and stopping of merely the audio
portion.  If you want the Flash movie to play through once and stop at the
end -- regardless of audio (which may have its own looping settings) -- put
a stop() function into a keyframe near or at the very end of your timeline.

   Insert a keyframe at the end of your timeline, click inside the
keyframe, open the Actions panel (Window > Actions) and type stop(); in the
script pane.  That's it.

> Second question is that I have uploaded it to a site.  My goal
> is to have it play just once and then automatically open the
> next page of her site without clicking on anything.  Is there a
> way to do this?

   Sure thing.  As the playhead moves along the timeline (this happens
internally, invisibly), the Stage itself updates visually and audibly in
response.  It's not unlike a flip book:  wherever your thumb happens to be
along the pages, that's the image showing.  Programming, too, is triggred as
the playhead encounters keyframes.  Instead of that stop() function in the
last keyframe of your main timeline, you could use the getURL() function
(assuming you're using ActionScript 1.0 or 2.0).  If you're in Flash CS3 and
using ActionScript 3.0, you'd use the navigateToURL() function instead.

   Look up either of those, as appropriate for the language at hand, in the
Help files (F1 key).  You'll get example code that you can simply "lift" and
reuse.  And if you get stuck, write back to this thread.  ;)

David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design."
Lost in the North - 03 Sep 2007 19:03 GMT
Thank you so VERY VERY much!! That is a perfect explanation!  I will go work on
it now and come back if I have any problems.  I am sorry I was unclear about
the audio part but that is exactly what I am confusing.   I was trying to
change that when I don't even have audio on the clip.  Just meant I wanted my
video clip to play through once and either stop or move the the next page.  I
am excited to go and try it, thanks again!
David Stiller - 03 Sep 2007 19:06 GMT
Lost in the North,

> Thank you so VERY VERY much!! That is a perfect
> explanation!

   Thanks.  :)  Glad to hear it.

David Stiller
Contributor, How to Cheat in Flash CS3
http://tinyurl.com/2cp6na
"Luck is the residue of good design."
Lost in the North - 04 Sep 2007 06:23 GMT
O.K., well it sounded straight forward until I went to try it ;-) On a good
note I figured out some other fun thigns but unfortunately not this.   I got
the stop function down but am having trouble with the navigateToURL() .
If I want to directly go to say a page named home.html do I need to type in
the whole http://www.mywebsite.com/home.html, just home.html or just home?  Not
sure all it needs or if I am even on the right track.  Am I just adding this to
the "windows", "actions" area?  Do I just need this one line or is there more
to it?  Do I need to add something to my html as well?
Sorry for the confusion!
David Stiller - 04 Sep 2007 14:14 GMT
Lost in the North,

> O.K., well it sounded straight forward until I went to try it ;-)

   Chin up.

> I got the stop function down but am having trouble with the
> navigateToURL() .

   You'll only be using navigateToURL() if you're using Flash CS3 and
ActionScript 3.0.  What version of Flash are you using?  What version of
ActionScript?  Select File > Publish Settings > Flash tab to double-check.

> If I want to directly go to say a page named home.html do I
> need to type in the whole http://www.mywebsite.com/home.html,
> just home.html or just home?

   navigateToURL(), and its AS2/AS1 equivalent, getURL(), both work just
like anchor tags (<a>) in HTML.  Use an absolute URL, like the above
(complete with http://) if you would in a traditional HTML document.  Use a
relative URL (such as home.html) if you like ... it's up to you.  The word
"home" on its own isn't a document, it's just a word, and Flash wouldn't
know what to do with it any more than a browser would.  ;)

> Not sure all it needs or if I am even on the right track.  Am I just
> adding this to the "windows", "actions" area?

   Look along the top of the Flash authoring environment.  You'll find a
file menu (File, Edit, View, Insert, Modify, etc.) ... near the end, one of
those choices is Window.  Select Window, and you'll get a dropdown menu.
This menu allows you to show and hide the various panels involved in your
routine Flash work.  The Actions panel is the thing that receives whatever
programming you choose to type in.  Code is attached to the selected object.
In other words, if you select a keyframe in some timeline, the code will be
attached to that keyframe, and will be executed when the playhead hits that
frame on playback.  Prior to ActionScript 3.0, it's possible to attach code
directly to certain objects like buttons and movie clip symbols, but the
syntax is a bit different if you go that route.  (This is not the route
you'd go here, in any case.)

   Here's a bit more detail on the direct-to-object approach, which is not
the current recommended best practice:

   http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent

> Do I just need this one line or is there more to it?

   You'll just need the one line.

> Do I need to add something to my html as well?

   Your one line tells Flash to let the browser know it needs to load a new
HTML document (home.html, in this case).  Assuming that HTML document is a
valid, renderable document, your browser will open it just fine.  That HTML
document may (or may not, at your discretion) contain further Flash content.

David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design."
Lost in the North - 05 Sep 2007 06:55 GMT
o.k., you must just cringe when you get rookies!  I have only been playing with
a flash a few days so it is all so new.  I am running Flash CS3 program and my
clip is Flash 9, Actionscript 3.0 if that helps.
I have tried to put in:

navigateToURL(http://www.mywebsite.com/home.html);

into the action request.  I must be really missing the picture here as I get
an error when I try to publish it.  

 "1084: Syntax error: expecting rightparen before colon."

I am assuming "rightparen" is right parenthesis?  Tried that.  I tried using
quotes around the url but that did not work either.  Help, I am just not
grasping this.  What am I missing?  Thank you for your patience!
David Stiller - 05 Sep 2007 18:48 GMT
Lost in the North,

> I have tried to put in:
>
> navigateToURL(http://www.mywebsite.com/home.html);

   Two things missing, there.  Notice in the ActionScript 3.0 Language
Reference, for the navigateToURL() entry, that the first parameter is of
type URLRequest.  The second parameter is of type String is is set to null.
In AS3, when a parameter like that is preset to some value (null or not),
that tells you that the parameter is optional, because it already has a
built-in value.  So in this case, you don't need to supply a string for the
window parameter, but if you do, you'll have to quote the string, and it'll
be one of the for listed under the window section under the Parameters
heading ("_blank" to open in a new window, etc., just like normal HTML).

   The first parameter, request, is not set to a built-in value, which
makes it a required parameter.  That's the one you'll need to supply, at a
minimum, and it must be an instance of the URLRequest class.  So ...

navigateToURL(new URLRequest());

   That's your first step.  If you look up the URLRequest class in the AS3
Language Reference, you'll see in the Public Methods section that the
URLRequest method -- the constructor, which is shown above) accepts an
optional String parameter.  (String because of the :String and optional
because of the = null.)  Obviously, you're going to have to supply an actual
value, because it makes no sense to send the browser to an undisclosed
location, so you're going to supply the url parameter even though it's
optional.  It's a String, so you'll put it in quotes.

navigateToURL(new URLRequest("http://www.mywebsite.com/home.html"));

... or ...

navigateToURL(new URLRequest("home.html"));

... depending on your desire (or not) for an absolute address.

> I get an error when I try to publish it.
>
>  "1084: Syntax error: expecting rightparen before colon."

   Yeah.  Unfortunately, the error messages don't always make intuitive
sense, though they usually do.  In this case, the error message isn't
especially helpful.

David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design."
Lost in the North - 07 Sep 2007 06:05 GMT
FINALLY figured it out!  Thanks so much for all your help.  I am sure I will
have a million more questions in the future but I will rest the brain cell (I
think there is only one sometimes) for now ;-)
Lost in the North - 07 Sep 2007 18:20 GMT
Sigh....O.K., I lied.  I thought I had figured it out because it works on my
computer but when I had another person try it it does not work for them.  I
double checked and it still works fine on mine.
So need input again.  This is what I have put into my "action", do I need a
stop() in there as well to stop the movie from replaying (that is what it is
doing on the other person's computer, just replaying and not moving to the next
page).  Anyways, here is what I had entered...

var url:URLRequest = new URLRequest("http://www.mywebsite.com/home.html");
navigateToURL(url, "_parent");
David Stiller - 09 Sep 2007 23:56 GMT
Lost in the North,

> So need input again.  This is what I have put into my "action",
> do I need a stop() in there as well to stop the movie from
> replaying

   That might just be it.

> here is what I had entered...
>
> var url:URLRequest = new URLRequest("http://www.mywebsite.com/home.html");
> navigateToURL(url, "_parent");

   Let's step through it.  Remember, Flash animation operates on a
particular metaphor:  a timeline metaphor.  In principle, an imaginary
playhead runs along the timeline (and along the optional timelines of nested
movie clips) from beginning to end.  As the playhead enters each frame, two
things occur:  first any ActionScript encountered and executed; second, any
visuals (tweening, for example) are updated on the Stage.

   In this case, the playhead enters a frame near (or at) the end of your
main timeline.  It encounters two lines of ActionScript.  First, it declares
an arbitrarily named variable, url, and sets it to some value.  The value
happens to be an instance of the URLRequest class, whose constructor is fed
a string.  That string represents a website URL.

   Next, the navigateToURL() function is invoked and fed two parameters.
First, the website URL, which was just stored as an instance of URLRequest
and stored in the variable url.  Second, the string "_parent", which
instructs the function to open its URL in the parent container of the HTML
document that contains this SWF.

   In theory, that should indeed replace the current HTML document --  
including this very SWF, since the SWF is *in* the document getting
replaced -- with the URL supplied.  You could invoke the MovieClip.stop()
method, either like this ...

this.stop();
var url:URLRequest = new URLRequest("http://www.mywebsite.com/home.html");
navigateToURL(url, "_parent");

... or like this ...

stop();
var url:URLRequest = new URLRequest("http://www.mywebsite.com/home.html");
navigateToURL(url, "_parent");

... and that certainly would hurt anything, but it shouldn't be necessary.
You may as well try it, but I wonder if your user has some version of Flash
Player lower than 9?  If your friend's computer has, say, Flash Player 8
installed, the visuals may very well show up, but the ActionScript 3.0 would
be ignored.

   Have you checked into Geoff Stearns' free JavaScript app, SWFObject?
It's a tiny program that does (at least) two very useful things:  a) lets
you ensure that your user has the minimum required version of Flash
Player -- you can provide default, alternate content for anyone who
doesn't -- and b) lets you sidestep the annoying "click to activate this
ActiveX control" message from recent versions of Internet Explorer.

   http://www.adobe.com/devnet/flash/articles/swfobject.html

David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design."
Lost in the North - 14 Sep 2007 05:28 GMT
I got it to work!!  Apparently I had an extra frame doing "something" that is was not supposed to. Removed it and it works great.  Thanks for all your help!
lenrique21 - 29 Sep 2007 19:18 GMT
The BEST way to create a Flash website is by going to
http://www.flashden.net?ref=luke

check it out!! Great files for 0.5 U$S!!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.