2
votes

iam planning to create a photo/video gallery secured by a pin. So i plan to have 4 pages, Login, Menu, Image Page and Video View. Login would be a simple textbox where i check the pin. The Menu would show all picture albums and videos in a list i create with clickable sprites or buttons or something like that. And a video view where a video will be shown if i click on a video link on the menu page.

I tried to prepare the scene in flash cs5, so i decided to create 4 frames. ALl pages have their own layer. The first will be the login, second the menu, third the image view (incl. thumbnail show and fullscreen view popup) and a video view. On each keyframe i put a rectangle converting it into a MovieClip acting as the main container where all the stuff will come into.

Now i tried to initialize all these MovieClips by resizing them everytime the stage is resized. For this i get errors, that some of the MovieClips are null. This is because the MovieClips exist only keyframe 2 for the menu or keyframe 3 for the image page and keyframe 4 for the video view. So i have to put them all into keyframe 1 to be able to access. But i created 4 keyframes because i want to jump to them by using "gotoAndStop( n)", where n stands for keyframe 2, 3 or 4.

I dont get it, how does Flash interpret the code and how is the visibility of these MovieClips. Can i only access the MovieClip from keyframe 2 because i added it on keyframe 2 only? What is the best solution to have a simple 4 page app where on page 1 (menu) i click on video link which holds some sort of ID of the video, then i jump to keyframe 4 for the video view providing it with that ID, but how to do that when Actionscript doesnt even know there is a video container MovieClip. To get Actioscript to know all of them, i have to move them to keyframe 1, but then how to do the paging stuff.

Look at the following screenshot from my project. It shows the timeline, with the 4 keyframes. As you see each layer has 4 frames, but only 1 keyframe for the MovieClip. I think i dont need to add 4 keyframes, do i?

Timeline screenshot from my Flash Video/Photo Gallery Project

I did a simple photo gallery before, but i used only one keyframe doing all the stuff in it, so i didnt have any problem when accessing all the MovieClips as i didnt need to do any jumping/paging. I would like to seperate each page having them on a seperate keyframe but being able to access the stuff in it via Actionscript. Did i misunderstood the way Actionscript is working??

Thanks in advance.

2

2 Answers

2
votes

I would stop using multiple frames (only have 1) and throw each of my "pages" in their own MovieClip. Then I would either make only my current page loginPageInstanceName.visible = true and the rest menuPageInstanceName.visible = false, etc... when needed, or even initialize each page movieClip as needed.

Personally, having code in multiple frames drives me nuts. I would have all code that effects things at the top level in only one place, preferably in a custom document class for your swf, alternatively in the top layer of frame one, like your "Action" layer. I would then throw code specific to each "Page" in it's own class, either within it's "export to actionscript" defined class or in the same manner as your top level code in the "Action" layer of the respective MovieClip.

I hope that helps.

0
votes

Short answer, first create a movieClip() then click inside of it delete its contents now start making the same thing again on that timeline but put all your code on the main timline and refer to the instance name for example

  AllmyClips.gotoAndStop(1);
  // allMyClips is the instance name 

  if(allMyClips.textbox1.text == "bob" && allMyClips.passwordbox.text == "thispassword"){
      AllmyClips.gotoAndStop(2);
    }

Its That easy just button1.addEventListners and throw the above in a function();

now all of viarbles can be global and easy to function if you can upload the fla somewhere and i will fix it for you, im bored so no problems and you shouldnt have large invisible clips in the background