FORUMS: list search recent posts

flash intro to index (should be easy, it's not)

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mark Gibson
flash intro to index (should be easy, it's not)
on Feb 18, 2009 at 4:29:04 am

Before I go any further, let me say that the "getURL("index2.html", "_self") has been tried and not worked in my case.

I'm trying to get a basic flash video intro to direct the browser to a home page upon completion. I've imported the video to the stage; there is one keyframe in the timeline. Here is what I have tried:

• The "getURL" procedure I see everywhere on the net as the solution to this problem, gets me an 1180 error, "Call to a possibly undefined method getURL"
• Upon selecting that keyframe and attempting to add an action, I get the message "Current selection cannot have actions applied to it."
• Behaviors, of course, "this action is not supported by ActionScript 3.0".
• I've tried switching to AS 2.0, but upon trying to publish, I get the message "The component 'fl.video.FLVPlayback' requires ActionScript 3.0."

I'm at my wit's end on this seemingly simple procedure. Any help would be greatly appreciated!


Return to posts index

Mark Gibson
Re: flash intro to index (should be easy, it's not)
on Feb 18, 2009 at 1:46:03 pm

Here is the AS3 code suggested on the Adobe Flash forums:

var url:String = "home2.html";
var req:URLRequest = new URLRequest(http://www.mywebsiteurl.com/home2.htm);
navigateToURL(req, "_self");

The problem is, the video does not play in testing now; I get the flashing FLV icon. Any suggestions?


Return to posts index

Seth Wood
Re: flash intro to index (should be easy, it's not)
on Feb 18, 2009 at 5:26:24 pm

Make sure that you apply the action after clicking on the image in the viewer, not on the frame in the timeline. It makes a difference. Your original code should have worked fine.
Hope you get it...
Seth Wood
http://www.dfxpro.com


VideoSwood
http://www.dfxpro.com


Return to posts index


Mark Gibson
Re: flash intro to index (should be easy, it's not)
on Feb 18, 2009 at 6:30:01 pm

Hi, Seth. Actually, when clicking on the image in the viewer, I get this message in the Actions window: "Current selection cannot have actions applied to it." But I have been able to get the desired effect (re-direct to a new Web page) with AS for the timeline keyframe, just not at the desired time - it opens the new Web page before playing the Flash intro, not after. This is the AS code I've gotten so far:

var url:String = "http://www.mgibsondigital.com/whiteconstruction/home2.htm";
var req:URLRequest = new URLRequest(url);
navigateToURL(req, "_self");

Now I just need to figure out how to get the action to take place after the Flash intro plays.


Return to posts index

Seth Wood
Re: flash intro to index (should be easy, it's not)
on Feb 18, 2009 at 6:40:56 pm

It sounds like the item is not set to be a button.
This is required in order to place the get_url script on it.
Select the item in the view... right click. Convert to symbol... select button... hit ok... select in the view again and try to apply your script. Hope I got everything.
Let me know if it works,
Seth
http://www.govamarketing.com


VideoSwood
http://www.dfxpro.com


Return to posts index

Mark Gibson
Re: flash intro to index (should be easy, it's not)
on Feb 18, 2009 at 6:59:12 pm

Actually, the item is a movie clip. I want it to play through, then bring up the home page. As I muddle through this, I've been told the getURL action is now navigateToURL in AS3. Why would they change this? To make ActionScript training all the more vexing, I would assume.


Return to posts index


Seth Wood
Re: flash intro to index (should be easy, it's not)
on Feb 18, 2009 at 7:04:00 pm

That is fine if you have a video clip in the flash, but to use the get_url you have to have it on a button. Just create a little graphic that says CLICK HERE or something and convert to symbol and apply code. Would this work for you?
Seth
http://www.swoodmedia.com


VideoSwood
http://www.dfxpro.com


Return to posts index

Mark Gibson
Re: flash intro to index (should be easy, it's not)
on Feb 18, 2009 at 7:37:21 pm

It is a video clip. Here is an example of what I'm trying to do: http://www.tic-inc.com Thanks again, Seth.


Return to posts index

Seth Wood
Re: flash intro to index (should be easy, it's not)
on Feb 18, 2009 at 7:58:38 pm

Check out this link...
http://www.dfxpro.com/flashcode/
Check out Sprite 130 @ frame 120

They put a STOP before the get_url
and it's on a separate layer.

Hope this helps.
Seth
http://www.dfxpro.com

VideoSwood
http://www.dfxpro.com


Return to posts index


demetri tashie
Re: flash intro to index (should be easy, it's not)
on Feb 18, 2009 at 8:42:16 pm

has this been resolved? on watching your intro movie, it does lead to your home page after playing ...

i assume you are using a CUE POINT at the end of your FLV to trigger the ActionScript?

in AS3, the code i use for the url request is:


var urlRequest:URLRequest = new URLRequest("http://www.mySite.com");

btnA.addEventListener(MouseEvent.MOUSE_UP, myFunction );

function myFunction(evt:MouseEvent):void { navigateToURL(urlRequest, '_self'); }

where urlRequest is the name of the variable, myFunction is the instance(or linkage) name of the function, btnA is the name of the button(or movie clip) ,and _self cause i want (http://www.mySite.com) to open in the same browser window.



Return to posts index

Mark Gibson
Re: flash intro to index (should be easy, it's not)
on Feb 19, 2009 at 2:55:23 am

Hi, Demitri. No luck yet, but you may be on to something with the cue point. I'm now trying to do this with a cue point at the end of the FLV, but still haven't had any luck with the following ActionScript:

var cuePoint = function(cues) {
var url:String = "http://www.mgibsondigital.com/whiteconstruction/home2.htm";
var req:URLRequest = new URLRequest(url);
navigateToURL(req, "_self"); }
vid.addEventListener("cuePoint", navigateToURL);

There is no button; I want the self-starting, one-frame video (movieclip) to automatically redirect the browser to the home page after it is done playing.

Any thoughts or suggestions would be greatly appreciated.


Return to posts index

cowcowcowcowcow
demetri tashie
Re: flash intro to index (should be easy, it's not)
on Feb 19, 2009 at 2:24:18 pm

OK -i must have been confused, but i see now that the example you posted ( tic-inc.com) was not YOUR site, but it is what you are trying to accomplish.

this is very doable in AS3. once again, i always have to state, i am not expert in these areas, i am just a guy who struggles with AS and tries to figure out how to accomplish what i want ( well, usually....), and am always glad to help someone else.

that being said:

i am changing my mind. since you only have one video playing, and want it to play to the end, we don't need CUE POINTs, but can do it with a (VideoEvent.COMPLETE) listener. YOU MUST IMPORT fl.video class FOR THIS WORK !

here are the steps i would do

1) import fl.video ! ( at the top of your Action panel, add this:
import fl.video.*;

2)set the source of your video player. do this in AS, not through the Component Inspector . i will assume you have a FLVPlayback Component on the stage. and are not adding an instance to the stage with AS ( doable of course !) . your FLVPlayback Component should have the instance name "flvPlayer" for this example. your source FLV is named " myFLV.flv " for this example. set any other properties you want at this time also.i will set auto play to true, and volume to 75% (.75 in AS3). you also MUST add the event listener to listen for the COMPLETE method. the function you need to create name it "myHomePage" for this example. the code for all of this:

flvPlayer.source="myFLV.flv"
flvPlayer.addEventListener(VideoEvent.COMPLETE, myHomePage);
flvPlayer.autoPlay= true;
flvPlayer.volume=.75;


3) set up your URL request:

var urlRequest=new URLRequest("http://www.mgibsondigital.com/whiteconstruction/home2.htm");

4) now tell the video what to do upon Completion : get the URL Request and head to your Home Page. i will assume you want it in the same Browser window ( _self) and not a new window ( _blank) :

function myHomePage(eventObject:VideoEvent):void
{ navigateToURL(urlRequest, '_self');}



that should really do it ! let us know how it works out.
of course make sure for the video source that you are using your correct directory source location on your server.


Return to posts index


Mark Gibson
Re: flash intro to index (should be easy, it's not)
on Feb 19, 2009 at 3:39:37 pm

THAT'S IT!!!! Demetri, you did it!! I never would have figured that out in a million years! Thank you, thank you, thank you so much! Demetri, you are my hero and a flash god!


Return to posts index

demetri tashie
Re: flash intro to index (should be easy, it's not)
on Feb 19, 2009 at 4:06:18 pm

thanks - no problem - glad to help.

thanks for the accolades ! but i am no flash god ! ...... maybe a flash angel !

all kidding aside- i end up knocking my head against the wall, with lots of blood shot eyes and sleepless nights over some of my AS problems, so we are all in the same boat.

i am rather new to this site, but i am loving this, and also the Dreamweaver forum for all the help and support people give. i have also received, so i like to give help if i think i can be helpful.

good luck! let's see your site when you are ready !



Return to posts index

Michael DeRemer
Re: flash intro to index (should be easy, it's not)
on Mar 25, 2010 at 11:32:07 pm

Hey i have a similiar problem and was hoping you could help.

Here is the function i call for my mouse event CLICK listener.

My flash movie is embedded in studentsSeats.aspx so basically it is just refreshing the page and adding the section variable to the url.
Then I want it to goto my label and play a tween.

The problem is it starts playing the tween before the page is fully loaded, then reloads the page and the tween never plays?? Do i need a listener to tell when the navigate is complete? and then execute the goto? I would appreciate your help.

function section14click(evt:MouseEvent):void{
section = "CC_Back14-15";
var url:URLRequest = new URLRequest("studentSeats.aspx?section=" + section);
navigateToURL(url, "_self");
gotoAndStop("sec14pressed");
}


Return to posts index


demetri tashie
Re: flash intro to index (should be easy, it's not)
on Mar 26, 2010 at 2:52:36 am

i don't work with asp/aspx , so i might not be the best person to answer this, but here is what i believe you could do to achieve this request.

i don't think this is a quick fix, but it should be able to be done. This would work on a regular HTML page with a swf. Your case is a little different in that the swf is telling the surrounding page to refresh, while the swf itself remains as is. so you need something - presumably javascript code outside of the swf- to tell the swf that the surrounding page has completed loading.

you would do this by importing and using External Interface class, which communicates back and forth from flash to javascript

i do recommend reading this Philip Kerman article as he explains this technique nicely - much better thani am trying to do ! :
http://phillipkerman.com/nab/nab_javascript_and_flash.pdf it is an older article, but it worked as of CS3. not sure if it has changed in CS4. check Adobe livedocs.

and of course this is all related to using everyday HTML, so it might not apply to aspx and i might be wasting your time...

code written in your flash swf will look something like this:

import flash.external.ExternalInterface;
ExternalInterface.addCallback ("aspxPageFunction", aspxPageFunction);
function aspxPageFunction(){ gotoAndStop("sec14pressed"); }


now remove the gotoAndStop("sec14pressed"); piece of code from your section14click function

the javascript code would look something like this:

thisMovie("myObjectID"). aspxPageFunction();
the swf movie name and ID in the HTML (used to be in the AC_FL_RunContent code ) needs to be given a unique Object ID - in this example it is "myObjectID"

of course the javascript has to be coded to only execute when the page fully loads, if that is what you want... similar to a preloader/redirect code

hope this helps with some ideas. sorry if does not relate to your project. but at any rate, you need to get that gotoAndStop code out of that function, becasue as it is, it IS written to run concurrently with the page load -so it seems to be acting exactly the way it was coded !


Return to posts index

Michael DeRemer
Re: flash intro to index (should be easy, it's not)
on Mar 26, 2010 at 1:30:25 pm

Alright thanks alot Sir. I'll play around with it. Do you know when a page reloads where the timeline ends up? It would seem like it should restart at the beginning again? I had an idea of using a global variable(evil i know but im sorry) and using it to keep track of which section was pressed. Then when the page reloads i would check to see if the global variable was set. It it was i would goto and play the tween, if not then i would just stay there. I would then reset the global variable to 0 after my tween played.

Apparently though when the page reloads it doesn't reload the swf? Because it never tries to execute the code i have in frame 1 of my actions layer.

So frustrating!! I just thought of a backup solution of only playing the zooming tween when they right click on a section. I think that should work. Not exactly what i want for usability but i really want the zoom functionality.


Return to posts index

demetri tashie
Re: flash intro to index (should be easy, it's not)
on Mar 26, 2010 at 6:13:06 pm

i'm a little overwhelmed by what you are asking - or maybe its the way you are asking it.

if a swf is on an html page, and the page reloads, the swf starts back at the very beginning, like it was upon first load.

now aspx is different, right? i am not so knowledgable about it so i can't answer specifics, but what relaods and what remains on the page unchanged depends on how you set up your asp/aspx.

IF the swf is not reloaded - but stays static while you change other elements on the page, then you could effect the swf via javascript based on how the page or elements on the page are loaded/reloaded etc. This would be done through the External Interface call.

in trying to make sense out of what you are explaining , i have to believe that you are probably way over complicating it, and/or approaching the project the wrong way. i am sure there could be other, easier and more concise ways of getting your goal accomplished. take a step back and plan what you expect to happen. once you can be clear in words( or diagram) what you want to happen, then you can begin coding and executing it to happen in that manner.

hope this helps.


Return to posts index


ellen Osborne
Re: flash intro to index (should be easy, it's not)
on May 22, 2010 at 9:15:06 pm

Hi
I'm trying to do the exact same thing as Mark, but I know a whole lot less about Flash. For that matter this is the first time I've ever used it. Anyway I tried to follow the directions above without luck. I imported a .fla file that is 3 seconds long. I put in a keyframe at 90 frames (the animation is 30 fps). Then i wrote in the following script.

import fl.video.*
import flash.net.URLRequest;

flvPlayer.source="hypnotic-wheel.flv"
flvPlayer.addEventListener(VideoEvent.COMPLETE, myHomePage);
flvPlayer.autoPlay=true
var urlRequest=new URLRequest("http://www.jimdultz.com/home.html);
function myHomePage(eventobject:VideoEvent):void
{navigateToURL(urlRequest,'_self');}

When I try to test it, Flash gives me the following error messages:

Scene 1, Layer 'Layer 1', Frame 90, Line 9 1094: Syntax error: A string literal must be terminated before the line break.
Scene 1, Layer 'Layer 1', Frame 90, Line 9 1084: Syntax error: expecting rightparen before _self.
Scene 1, Layer 'Layer 1', Frame 90, Line 7 1095: Syntax error: A string literal must be terminated before the line break.

I have no idea what any of this means. Can you help? I'm using Flash CS5
Thanks.



Return to posts index

ellen Osborne
Re: flash intro to index (should be easy, it's not)
on May 22, 2010 at 9:52:30 pm

I just tried this again on frame 1 with only one keyframe on the timeline. I thought I found a few typos on how I typed it in before, but I get pretty much the same errors.

Here is what I put in

import fl.video.*;
import flash.net.URLRequest;

flvPlayer.source="hynotic-wheel.flv"
flvPlayer.addEventListener(VideoEvent.COMPLETE, myHomePage);
flvPlayer.autoPlay=true;
flvPlayer.volume=75;
var urlRequest=new URLRequest("http://www.jimdultz.com/home.html);
function myHomePage(eventObject:VideoEvent):void
{ navigateToURL(urlRequest, '_self');}

This is what flash tells me

Scene 1, Layer 'Layer 1', Frame 1, Line 8 1095: Syntax error: A string literal must be terminated before the line break.
Scene 1, Layer 'Layer 1', Frame 1, Line 10 1084: Syntax error: expecting rightparen before _self.
Scene 1, Layer 'Layer 1', Frame 1, Line 10 1094: Syntax error: A string literal must be terminated before the line break.

Hope someone can help. Thanks




Return to posts index

demetri tashie
Re: flash intro to index (should be easy, it's not)
on May 22, 2010 at 10:03:23 pm

add a terminating quote sign on this line:
var urlRequest=new URLRequest("http://www.jimdultz.com/home.html);

like this

var urlRequest=new URLRequest("http://www.jimdultz.com/home.html");

and it will work


Return to posts index


ellen Osborne
Re: flash intro to index (should be easy, it's not)
on May 23, 2010 at 2:33:31 pm

Before you responded and In my search for a solution I came across the code below, which I wrote on a separate layer at frame 90.

var request:URLRequest = new URLRequest("http://www.jimdultz.com/home.html");
navigateToURL(request,"_self");

It works perfectly in the Flash test movie function, but when I upload it to the site, the movie doesn't play although the page still jumps to the new page after 3 seconds. So I guess the code is working, but why doesn't my movie play?





Return to posts index

ellen Osborne
Re: flash intro to index (should be easy, it's not)
on May 23, 2010 at 4:09:19 pm

Now the most recent code that I used doesn't seem to work right either. It keep loading itself over and over every 3 seconds. Also tried your code from above that you gave to Mark (adding the quotation). I don't get any errors but nothing happens when I try it in Flash's test movie.

Should I have a keyframe at 90 frames? And should the code be on that frame?
Should the code be on the same layer or a different layer?




Return to posts index

demetri tashie
Re: flash intro to index (should be easy, it's not)
on May 23, 2010 at 4:14:34 pm

i am not sure anymore what you are trying to do. can you explain again ( simply and clearly )

also, i am not clear on your keyframe / frame 90 question.

in general, ALL code, if writen in the main swf's file, should ideally only be on the first frame.


Return to posts index


ellen Osborne
Re: flash intro to index (should be easy, it's not)
on May 23, 2010 at 4:44:04 pm




Return to posts index

ellen Osborne
Re: flash intro to index (should be easy, it's not)
on May 23, 2010 at 4:45:43 pm

Hi Demetri
I'm sorry for being so confusing. That's because I'm pretty confused!

Ok from the beginning.
I have a flash intro movie that I want to jump to a URL once it is complete. The movie is 3 seconds long or 90 frames.

I put a keyframe in at 90 frames and put the following code on it.
navigateToURL(new URLRequest("http://www.jimdultz.com/home.html"), "_self");

When I upload this to my server. The movie doesn't play (there is only a white box)then after 3 seconds it jumps to the new URL request. You can see what it's doing here http://www.jimdultz.com

It works fine in Flash "test movie" tool.

Thanks for the help.
Ellen



Return to posts index

demetri tashie
Re: flash intro to index (should be easy, it's not)
on May 23, 2010 at 4:54:43 pm

quote: " flash intro movie that I want to jump to a URL once it is complete. The movie is 3 seconds long or 90 frames "

what does this mean? originally you said it was a video(.flv), is it a movie(.swf) or movieclip instead?
or is it ( god forbid) embedded video in a movie clip or swf ??

please calrify.

COMPLETE works for videos playing in a flvplayback component. if you are just wanting to go to a url from a different event( upon reaching the last frame of a movieclip for example, you need to do it differently


Return to posts index

ellen Osborne
Re: flash intro to index (should be easy, it's not)
on May 23, 2010 at 5:11:10 pm

Well I imported a .f4v into Flash. (It was originally made in Apple Motion, output as QT, converted to f4v with Media Encoder.) It's 3 seconds long. It is not embedded. When I import the file, Flash shows it as a SWF in the property inspector. It's on the stage and is layer one. I exported the file to Dreamweaver from Flash as a .swf to load on to the site.

I guess COMPLETE is what I'm looking for...




Return to posts index

demetri tashie
Re: flash intro to index (should be easy, it's not)
on May 23, 2010 at 5:49:21 pm

please re-post this as a new thread. it has veared off from the original topic. i willcommet to the new thread


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]