Jump to content
Search Community

orangemix

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by orangemix

  1. hi there, I am fairly new to AS, OOP and everything else. I am more of a designer than coder, but I want to integrate the two. I have developed a simple site that I am trying to deeplink, the title bar and address bar are changing accordingly but the view states with the browser forward and back buttons is not following the path of view states or changing them for that sake. Any help would be greatly appreciated. I'm not really sure how much code to paste, but here is my main class. Thanks!!! public class OceanAccessories extends Sprite { private var backgroundCont:Sprite; private var homeCont:Sprite; private var tabCont:Sprite; private var supplyCont:Sprite; private var fulfillCont:Sprite; private var mfgCont:Sprite; private var backBG:AbFactoryOM; private var slideShow:AbFactoryOM; private var homePages:AbFactoryOM; private var tabPages:AbFactoryOM; private var supplyPage:AbFactoryOM; private var fulfillPage:AbFactoryOM; private var mfgPage:AbFactoryOM; private var descriptionBox:AbFactoryOM; private var bgGraphics:AbBackgroundOM; private var prodShow:AbBackgroundOM; private var homeBtns:AbTabButtonsOM; private var supplyTab:AbTabButtonsOM; private var supplyBtns:AbPagesOM; private var fulfillBtns:AbPagesOM; private var mfgBtns:AbPagesOM; private var descBox:AbTabButtonsOM; private var currentPage:Sprite = new Sprite(); private var currentButton:Sprite = new Sprite(); private var emptyCont:Sprite = new Sprite(); private var emptyPage:Sprite = new Sprite(); private var eventList:RefList = new RefList(); private const BG_X:Number = 30; private const BG_Y:Number = 190; private const SPLASH_X:Number = 225; private const SPLASH_Y:Number = -25; private const HOME_CONT_X:Number = 100; private const HOME_CONT_Y:Number = 220; private const TAB_CONT_X:Number = 315; private const TAB_CONT_Y:Number = 92.75; private const SUPPLY_CONT_X:Number = 480; private const SUPPLY_CONT_Y:Number = 460; private const FULFILL_CONT_X:Number = 310; private const FULFILL_CONT_Y:Number = 450; private const MFG_CONT_X:Number = 480; private const MFG_CONT_Y:Number = 500; private const SLIDES_X:Number = 27; private const SLIDES_Y:Number = 235; public function OceanAccessories() { ExternalInterface.call("showSlide"); ExternalInterface.call("homepage"); startCommunication(); createHomePage(); createSplash(); createSlideShow(); SWFAddress.addEventListener(SWFAddressEvent.EXTERNAL_CHANGE, handleSWFAddressChange); } private function createSlideShow():void { backgroundCont = new Sprite(); backgroundCont.x = BG_X; backgroundCont.y = BG_Y; addChild(backgroundCont); slideShow = new ConcreteHomePage(); prodShow = slideShow.foregroundMethod(); prodShow.x = SLIDES_X; prodShow.y = SLIDES_Y; backgroundCont.addChild(prodShow); } private function createSplash():void { var splash:HeaderSplash = new HeaderSplash(); splash.x = SPLASH_X; splash.y = SPLASH_Y; addChild(splash); } private function createDescBox(me:CustomEventsOM):void { descriptionBox = new ConcreteTabPage(); descBox = descriptionBox.descBoxMethod(); descBox.x = 50; descBox.y = 205; addChild(descBox); } private function createHomePage():void { homeCont = new Sprite(); homeCont.x = HOME_CONT_X; homeCont.y = HOME_CONT_Y; addChild(homeCont); homePages = new ConcreteHomePage(); homeBtns = homePages.homeBtnsMethod(); homeCont.addChild(homeBtns); currentButton = homeCont; homeEventHandlers(); } private function startCommunication():void { ExternalInterface.addCallback("returnHomePage", returnHomePage); } private function contactPage(me:CustomEventsOM):void { SWFAddress.setValue("Contact"); addChild(emptyCont); if(currentButton == homeCont) { return; }else if(currentPage !== emptyPage) { addChild(emptyPage); removeChild(currentPage); currentPage = emptyPage; } } private function returnHomePage(value:String):void { if(currentButton == homeCont) { return; }else if(currentButton !== homeCont) { removeChild(currentButton); removeChild(descBox); homeCont = new Sprite(); homeCont.x = HOME_CONT_X; homeCont.y = HOME_CONT_Y; addChild(homeCont); homePages = new ConcreteHomePage(); homeBtns = homePages.backHomeMethod(); homeCont.addChild(homeBtns); currentButton = homeCont; homeEventHandlers(); animateTabs(); addChild(emptyPage); if(currentPage !== emptyPage) { removeChild(currentPage); currentPage = emptyPage; } } } private function animateTabs():void { TweenMax.to(tabCont, .5, {alpha:0}); } private function createSupplyTab(me:CustomEventsOM):void { TweenMax.to(homeCont, 2, {alpha:0}); tabCont = new Sprite(); tabCont.x = TAB_CONT_X; tabCont.y = TAB_CONT_Y; addChild(tabCont); currentButton = tabCont; tabPages = new ConcreteTabPage(); supplyTab = tabPages.supplyMarkerMethod(); tabCont.addChild(supplyTab); var supply:String = "onSupplyClick"; this[supply](me); } private function onSupplyClick(me:CustomEventsOM):void { if(fulfillCont || mfgCont) { removeChild(currentPage); } changePage("SupplyChain"); supplyCont = new Sprite(); supplyCont.x = SUPPLY_CONT_X; supplyCont.y = SUPPLY_CONT_Y; addChild(supplyCont); supplyPage = new ConcreteTabPage(); supplyBtns = supplyPage.supplyMethod(); supplyCont.addChild(supplyBtns); currentPage = supplyCont; tabEventHandlers(); } private function createFulfillTab(me:CustomEventsOM):void { TweenMax.to(homeCont, 2, {alpha:0}); tabCont = new Sprite(); tabCont.x = TAB_CONT_X; tabCont.y = TAB_CONT_Y; addChild(tabCont); currentButton = tabCont; tabPages = new ConcreteTabPage(); supplyTab = tabPages.fulfillMarkerMethod(); tabCont.addChild(supplyTab); var fulfill:String = "onFulfillClick"; this[fulfill](me); } private function onFulfillClick(me:CustomEventsOM):void { if(supplyCont || mfgCont) { removeChild(currentPage); } changePage("Fulfillment"); fulfillCont = new Sprite(); fulfillCont.x = FULFILL_CONT_X; fulfillCont.y = FULFILL_CONT_Y; addChild(fulfillCont); fulfillPage = new ConcreteTabPage(); fulfillBtns = fulfillPage.fulfillmentMethod(); fulfillCont.addChild(fulfillBtns); currentPage = fulfillCont; tabEventHandlers(); } private function createMfgTab(me:CustomEventsOM):void { TweenMax.to(homeCont, 2, {alpha:0}); tabCont = new Sprite(); tabCont.x = TAB_CONT_X; tabCont.y = TAB_CONT_Y; addChild(tabCont); currentButton = tabCont; tabPages = new ConcreteTabPage(); supplyTab = tabPages.mfgMarkerMethod(); tabCont.addChild(supplyTab); var mfg:String = "onMfgClick"; this[mfg](me); } private function onMfgClick(me:CustomEventsOM):void { if(supplyCont || fulfillCont) { removeChild(currentPage); } changePage("Manufacturing"); mfgCont = new Sprite(); mfgCont.x = MFG_CONT_X; mfgCont.y = MFG_CONT_Y; addChild(mfgCont); mfgPage = new ConcreteTabPage(); mfgBtns = mfgPage.manufacturingMethod(); mfgCont.addChild(mfgBtns); currentPage = mfgCont; tabEventHandlers(); } private function homeEventHandlers():void { eventList.addReferencedListener(homeBtns, CustomEventsOM.SUPPLY_CLICK, createSupplyTab); eventList.addReferencedListener(homeBtns, CustomEventsOM.FULFILL_CLICK, createFulfillTab); eventList.addReferencedListener(homeBtns, CustomEventsOM.MFG_CLICK, createMfgTab); eventList.addReferencedListener(homeBtns, CustomEventsOM.DESC_BOX, createDescBox); } private function tabEventHandlers():void { eventList.addReferencedListener(supplyTab, CustomEventsOM.SUPPLY_CLICK, onSupplyClick); eventList.addReferencedListener(supplyTab, CustomEventsOM.FULFILL_CLICK, onFulfillClick); eventList.addReferencedListener(supplyTab, CustomEventsOM.MFG_CLICK, onMfgClick); eventList.addReferencedListener(supplyTab, CustomEventsOM.CONTACT_CLICK, contactPage); } private function handleSWFAddressChange(e:SWFAddressEvent):void { trace("SWF Address Value == "+SWFAddress.getValue()); switch(SWFAddress.getValue()) { case "/": SWFAddress.setTitle(" Ocean-Accessories - Home "); break; } switch(SWFAddress.getParameter("page")) { case "SupplyChain": SWFAddress.setTitle(" Ocean-Accessories - Supply Chain "); break; case "Fulfillment": SWFAddress.setTitle(" Ocean-Accessories - Fulfillment "); break; case "Manufacturing": SWFAddress.setTitle(" Ocean-Accessories - Manufacturing "); break; } } private function changePage(p:String):void { SWFAddress.setValue("?page="+p); } private function handleBack(e:MouseEvent):void { if(SWFAddress.getValue()!=="/") { SWFAddress.back(); } } private function handleNext(e:MouseEvent):void { SWFAddress.forward(); } } }
  2. hey there, maybe I can get a quick tip... I can't find the original post for this thread, but I have utilized the code above from the original post to create a simple slideshow. When I upload to view live on the web it seems as though the xml is not loading images quick enough because I get an error saying I cannot tween a null object. Which is what leads to my assumption. TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.slideshow::SlideShow/displaySlide() at com.slideshow::SlideShow/showRandom() I am still very new to AS and web development in general, please excuse me for my ignorance. I am using the abstract factory pattern for this, with a preloader swf, not sure if that has any impact. I have also built another slideshow using the slideshow.zip example that you have posted and I'm not sure how or if I could incorporate the two to get the desired effect or if it's just a simple tweak. I guess my question is how do I get my xml to load all images first... it's only 15 images, and very small in size. here is a link to a test page if it helps clarkesque.com/OA/index.html any help is apprecaited Thanks!!!
×
×
  • Create New...