A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: How to start loading on click ?

Hybrid View

  1. #1
    Senior Member
    Join Date
    Oct 2002
    Posts
    211

    How to start loading on click ?

    I've used all sorts of combinations of Flix and Linx and SWFX for movies and graphics and navigation with great success, but funnily enough I've never tried this before and I'm stumped.

    I want to line up about a dozen swf movies on a single page. By the nature of the material visitors will only want to look at a few of them. So what I need is that the movie only starts loading when you click on it, and then plays in place on the page. Sure I could do it with link graphics and pop-ups but that's not appropriate in this case.

    So how could it be done ? I can easily embed the pieces on the page of course, but how to activate the loading on click ?

    Also, is there a way I can display the first frame of the movie on the page ? I could just take a grab from the actual movie and make that a separate jpg or swf, but then what ?

    Lots of questions...any ideas ?

    Thanks

  2. #2
    Wildform Moderator
    Join Date
    Sep 2000
    Posts
    2,070
    Hi.
    There are a number of ways to do that.
    Possibly the easiest way using the software you have is to create one large SWF in Linx with images of all the videos. You can use the "export 1st frame as jpeg" option in Flix Pro to export the first frames of all the videos. Create all the videos in Flix and add the on-click play functionality to each. Line up the images on a single canvas in Linx and then add a mouse-event to each image telling it to load the associated video into a target SWF, which could be the image itself, when it is clicked. When the video finishes you could have it unload automatically or re-load the image.
    I hope this is clear.
    It's essentially just a big video jukebox. We'll be putting up a tutorial soon that deals with this using Flix, Linx and SWfX.
    jb

  3. #3
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    Thanks as always JB, I knew you'd have some good ideas

  4. #4
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    Well, I'm not having much luck with this.

    Here's what I've done:

    I have a swf in the main movie in Linx. It's a sprite and has a simple on-click mouse event to loadmovie MOVIE2 into the sprite.

    OK, that works fine.

    So MOVIE2 plays happily. But here's the catch: no matter what I do I can't get MOVIE2 to just stop. If I load up MOVIE2 in Linx and play it then the play an stop command works perfectly. As soon as I play it via loadmovie then it simply won't stop - instead it flicks back to the start and begins playing.

    So, you might ask "have you got begin automatic playback selected ?" Yes I have. Because if I instead choose click to begin playback, or insert a stop action, or insert a gif with a goto frame action, then it simply won't begin playing at all.

    It seems that as soon as I load MOVIE2 via loadmovie some of its controls get disabled.

    My eyes are like sandpaper, my breathing laboured and my mind is overheated. I had promised this project would be finished yesterday - serves me right for trying something ambitious.

    All ideas received with pathetic gratitude.

    S

  5. #5
    Wildform Moderator
    Join Date
    Sep 2000
    Posts
    2,070
    Hi.
    If you're loading into a sprite, then the file will loop continuously like any other sprite.
    jb

  6. #6
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    Oh. Thanks JB, something incredibly simple again...

    So is there any alternate method I can use so it loads on click but doesn't loop ?

    S

  7. #7
    Wildform Moderator
    Join Date
    Sep 2000
    Posts
    2,070
    What exactly are you trying to accomplish? If you give me more info I can try to think up alternatives.
    Off the top of my head, you could:
    -unload the swf by putting in an unload action (but then it won't be there anymore)
    -extend the swf you are loading by extending its last frame in Linx so it will hold on the last frame for longer before looping

    jb

  8. #8
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    The main movie has a series of clickable areas, each one a small swf which is a sprite.

    When you click on one of these sprites it uses the loadmovie action and is replaced by another swf that looks exactly the same except that it includes an audio file and a stop and play button (the Linx default buttons for these actions). An example of this new stop/play file that I'm loading is what I emailed to you.

    So, this new file plays happily. At the end it simply stops and remains in place - and this is exactly what I want, BUT... at the moment clicking the stop button just restarts the audio. I simply want the stop button to stop the audio. By itself this file works perfectly, but inserted in the original sprite using loadmovie it doesn't.

    So the essence of my problem is this: how do I get this movie to stop on demand after it is loaded in the spite ? That's it. That's the only problem.

    But the various actions I've tried to achieve this all work well in standalone mode, but as soon as I load the file into the sprite the actions just don't seems to work. For example, I've tried to make the loaded swf contain a click-goto frame number (at the end); and also click and unload, and also click and reload the original swf, but none have the desired effect... in all cases the movie justs restarts from the beginning, or simply never starts at all.

    The point of doing it like this is so that I can have ten or so audio files ready to go and each one will start to load and stream only when the user clicks on it.

    It is quite maddening. Just stop damn you !!


  9. #9
    Wildform Moderator
    Join Date
    Sep 2000
    Posts
    2,070
    How are you creating the audio files?
    Try creating them in Flix and add the play controls in Flix.
    jb

  10. #10
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    That works ! ( It'd be better if it returned to the first frame of the swf rather than the 100% loaded screen, but I can live with that. At least it stops now. Hurrah ! )

    BUT: Each little swf is now encased in a rather large player and looks quite absurd on the page (quite apart from the fact that there just isn't room to allow 12 little Flix players to pop up).

    Isn't there anyway to get the control function of the Flix "stop" action in Linx without using the Flix player ?

    EDIT: I'm going to try to re-import the "Flix player version" of the swf back into Linx and edit the swf again in there, but it seems like a rather involved way of doing things. I'm almost tempted to go back into Flash MX and do it, but that's the last resort. Surely I'm not asking too much to get this functionality ?
    Last edited by Spirit of 44; 04-18-2003 at 09:53 PM.

  11. #11
    Wildform Moderator
    Join Date
    Sep 2000
    Posts
    2,070
    a) you can make a custom player that looks the way you want, including a blank custom player, but i thought you wanted to give the user play controls?
    b) did you try just encoding the audio in flix without the play controls?
    c) if you don't use a preloader it won't stop on the 100% loaded screen

    jb

  12. #12
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    I think I'm beginning to see the answer: as you suggest I'll create a really tiny Flix player with just a play/pause/stop controls and mute, and feed the original wav files into that.

    Now that I'm getting close to a solution, can I mention one other little annoyance ? The "% Loaded" display is so minute when you start working like this that it's almost invisible.

    Of all the things I've suggested over the months I think the best would be some way to vary the size, shape and style if this display message. For example, what I'd *really* like is a scalable progress bar preloader. That would be brilliant !

    As always you've been really helpful JB, and without Linx and Flix I wouldn't have even considered accepting this project !
    Last edited by Spirit of 44; 04-18-2003 at 10:28 PM.

  13. #13
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    Well, I made a new player with just some audio controls.

    But every time I tried to encode I got: "Wildform Flix encountered an error creating a player".

    So I made another.

    Same thing.

    Then I tried to encode audio-only in ANY Flix player and every time I got: "Wildform Flix encountered an error creating a player".

    So there it is: you can't encode audio-only in a player, so there goes that idea. Can someone else try this and confirm that I'm not insane ?

    My workaround is to create a swf in Linx with a dummy image, then rake this into Flix and "encode existing swf" in a player. That works, but it's painful. EDIT: It works SOMETIMES. It does not work if you use a Flash 4 player and rip that apart - it only works with a Flash 5 player. F$%#@. What a waste of time.

    All this for a decent stop control in Linx ? It's getting a bit silly.

    thanks,
    S
    Last edited by Spirit of 44; 04-19-2003 at 04:49 AM.

  14. #14
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    For anyone following this quite pathetic saga, here's the solution I've come up with just to get this now royally loss-making project done:

    A swf called "play" uses loadmovie to play the audio swf in a third, empty swf

    A swf called "stop" uses loadmovie to load a blank swf into the swf that's playing the audio swf

    It's a bit messy.

    It doesn't allow for any player controls beyond play & stop.

    Here's what I'd like instead:

    1) Flix to be able to encode audio-only into a player (since even when I finally did wrap an external swf, the controls DID NOT WORK just like the useless Linx controls.... are Flash 4 controls the problem here ?) It's a real shame this didn't work since I created a very nice little 80px x 30px audio player...

    2) The Linx "stop" action to actually WORK when in a swf activated using loadmovie. Or any other Linx command for that matter.

    In that far distant dreamland everything would be so simple.

    That said, the project is finally starting to look good and again there's NO WAY I could have done this in MX or Swish, so praise be to my flawed little friend Linx.
    Last edited by Spirit of 44; 04-19-2003 at 01:03 PM.

  15. #15
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    I also have to add this which I brought up before but which was dismissed with a "reload the app" comment (which I did). Maybe it's just me, but I don't belive so...

    The area of an inserted transparent swf is NOT the active area when you either need to loadmovie into it, or use it as a onclick area. The actual size seems to be able one-half to one-quarter the apparant area.

    Needless to say this creates major problems when loading another swf into it, or using it as a link-click swf.

    In all situations I have to hugely expand the swf using trial-and-error to find the point where it appears to approximately cover the desired area.

    Can someone else try this ?

    Insert a transparent swf from the Linx timeline, distort the dimensions to something new, then make it an onclick event. See whether the area matches its apparant size.

    I'd really like to know whether this is just me or not because it's very annoying....

  16. #16
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    Fonally finished it using the methods described above, phew !

    For anyone interested here's the show:

    http://theaustralian.com.au/extras/m...mainmovie.html

  17. #17
    Wildform Moderator
    Join Date
    Sep 2000
    Posts
    2,070
    Hi.
    Cool stuff Richard.
    Regarding the transparent swf issue, can you tell me exactly which version of Linx you are using? It should be in the about box.
    jb

  18. #18
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    version 1.100

    My experiments show that the swf is fine if you leave it large, but try making it smaller. Beneath a certain critical threshold it seems to lose itself and instead of having an active width of, say, 50 pixels, it seems to contract to about 10.

    With a apparant width of 80 pixels the active area is about 40 pixels.

    When you get back to about 100 pixels the swf seems to magically correct itself and everything is OK again...

    Most odd.

    S

  19. #19
    Wildform Moderator
    Join Date
    Sep 2000
    Posts
    2,070
    I'm checking it out.
    jb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center