Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by icekomo

  1. Hello, I have a question, and it may be a simple one as I am no AS3 expert. I have an object that is hooked up to a mouseOver event. When the mouse rolls over this object it moves it say 10 pixels to the left, and when it roll off, it moves that object back. The problem I ran into is that when i resize the window, it's still using the old x cords. So my question is what can I do to get the new x postion of that object each time the mouseEvent is called? Do I use the update function for that info? And if so, how exactly. Thanks!!
  2. I can't seem to figure out how to access cue points in a flv being called in from xml. I feel like I'm sure close to figuring this one out, but seem to be stuck in this area. I am able trace when the cue point hits in the video but i'm not sure how to advance the the movie to another cue point. Here is the method that the cue point triggers. private function rabiVideo(event:LoaderEvent):void { trace("cue point"); if (event.data.name=="Loop") { trace("Loop"); //_currentVideo.seekToNavCuePoint("NoStart"); //_currentVideo.play(); } } the trace loop works, but not the seekToNavCuePoint.... the commented out code isn't working.. any suggestions? Thanks!
  3. Hello, I'm missing something from my code but for the life of me can't seem to figure it out. I created a class to handle my button actions, MouseOver,Off and will also handle the click function. I got it working but I'm lost as to how I target just the button that I am rolling on to and not the movieClip the button lives in. Here is my code: package classes.menu { import flash.display.*; import flash.text.TextField; import flash.events.*; import com.greensock.*; import com.greensock.easing.*; public class MenuButtons extends MovieClip { public function MenuButtons() { this.mouseChildren = false; this.buttonMode = true; addButtonTitles(); } public function addButtonTitles():void { trace("menu buttons"); this.addEventListener(MouseEvent.MOUSE_OVER, rollOverBtn); homeBtn.white.txt.text = "HOME"; homeBtn.blue.txt.text = "HOME"; } public function rollOverBtn(event:MouseEvent):void { TweenLite.to(event.target,1,{alpha:.5}); this.addEventListener(MouseEvent.MOUSE_OUT, rollOffBtn); trace("rollOver"); } public function rollOffBtn(event:MouseEvent):void { TweenLite.to(event.target,1,{alpha:1}); trace("rollOver"); } } } As I said before when I roll over one of the buttons I just want that button to alpha fade, not the whole _mc that it lives int. I tried to use event.target but that didn't seem to do what I was looking for. Any help on this would be very grateful! Thanks
  4. I get these 2 errors: 1180: Call to a possibly undefined method ImageLoaderVars. 1061: Call to a possibly undefined method prependURLs through a reference with static type com.greensock.loading:ImageLoader. I thought I had the correct stuff imported.
  5. could I also add this to direct where all my images for this loader are living? iLoad.prependURLs("images/aSpot/");
  6. Thanks for your help on this. Where are you getting this from? new ImageLoaderVars()
  7. Hello, I have a preloader that I created using loaderMax. I got the xml and the swf file to loading. But now I would like to add an array of images, say 10 to this file, and I'm not sure what the best way to go about this would be. Any helpful hints in the right direction would be great! Here is what I have so far. public class Preloader extends MovieClip { public var queue:LoaderMax = new LoaderMax({name:"mainQueue",onComplete:completeHandler,onError:errorHandler}); public var progressBar:MovieClip = new progBar_mc(); public function Preloader():void { addChild(progressBar); //starts the load for the XML queue.append( new XMLLoader("xml/medallion.xml", {name:"myXML",onProgress:progressHandler,onComplete:loadXml})); //starts the load for the swf file, and adds it to this container queue.append( new SWFLoader("medallion.swf", {onProgress:progressHandler,estimatedBytes:126000,container:this})); queue.load(); progressBar.loadText.text = "loading xml"; } Thanks!
  8. Ok I'm slowly working my way through this process, but one thing I seem to be stumped on. How do I trace the actual data of a css stylesheet that I loaded? Right now when I trace: trace(LoaderMax.getConetent("myCSS"); I get returned: [object StyleSheet] I'm having a tough time figuring out how to apply the style sheet to my text. THanks
  9. I should also say, that I'm not getting any error any more, but the text is not being styled either....
  10. Here is the preloader code that I am using: I altered it a bit so that I have a simple textfield on the stage(myTextField) and gets filled with some xml, and I am trying to apply a style sheet to that, figure start small and go from there, but even thats not working, I get the xml to show up, but it's not styled. package com.main { import flash.display.*; import com.greensock.events.LoaderEvent; import flash.events.*; import flash.display.MovieClip; import flash.text.TextField; import flash.text.StyleSheet; import flash.events.Event; import com.greensock.easing.*; import com.greensock.*; import com.greensock.plugins.*; import com.greensock.layout.*; import com.greensock.loading.*; import com.greensock.loading.display.*; public class Preloader extends MovieClip { var queue:LoaderMax = new LoaderMax({name:"mainQueue",onComplete:completeHandler,onError:errorHandler}); var progressBar:MovieClip = new progBar_mc(); public function Preloader() { addChild(progressBar); //starts the load for the XML queue.append( new XMLLoader("xml/elReyMenus.xml", {name:"myXML",onProgress:progressHandler,onComplete:loadXml}) ); queue.append( new CSSLoader("xml/styles/styles.css", {name:"myCSS",onProgress:progressHandler}) ); //starts the load for the swf file, and adds it to this container queue.append( new SWFLoader("elRey.swf", {onProgress:progressHandler,estimatedBytes:126000,container:this}) ); //loads the data queue.load(); progressBar.loadText.text = "loading xml"; } public function loadXml(event:LoaderEvent):void { progressBar.loadText.text = "loading data"; } public function progressHandler(event:LoaderEvent):void { //trace("progress: " + event.target.progress); var perc:Number = event.target.bytesLoaded / event.target.bytesTotal; progressBar.prog_txt.text = Math.ceil(perc * 100) + "%".toString(); progressBar.loadBar_mc.width = perc * 271; } public function completeHandler(event:LoaderEvent):void { var xmlData:XML = LoaderMax.getContent("myXML"); myTextField.htmlText = xmlData.Brunch; myTextField.styleSheet = LoaderMax.getContent("myCSS"); trace(event.target + " is complete!"); TweenLite.to(progressBar,2,{alpha:0}); } public function errorHandler(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } } } CSS: boldtitle { font-weight: bold; display: inline; font-size: 16px; } boldText { font-weight: bold; display: inline; } smallText{ display: inline; font-size: 11px; } XML: </p><p>&nbsp;</p><p><boldtitle>Soft Drinks</boldtitle></p><p>&nbsp;</p><p><boldText>Agua Frescas</boldText></p><p>Tamarindo</p><p>Jamaica</p><p>Horchata</p><p>&nbsp;</p><p><boldText>Jarritos</boldText></p><p>Pineapple</p><p>Grapefruit</p><p>Mandarin</p><p>&nbsp;</p><p><boldText>Refrescos</boldText></p><p>Sidral Mundet Apple Soda</p><p>Mexican Coca-cola</p><p>
  11. That didn't seem to work. WIth the xml data I had to do this: var xmlData:XML = LoaderMax.getContent("myXML"); brunchMenu.Menu_mc.content_mc.menuTxt.htmlText = xmlData.Brunch; I had to type case the data into xml for it to be able to use it, do I have to do something similar with the css data? Thanks for you help on this!
  12. So after more looking into it I think my problem lies here: var cssData:StyleSheet = LoaderMax.getContent("myCSS"); var sheet:StyleSheet = new StyleSheet(); sheet.parseCSS(cssData.data); trace(cssData.data); //trace("css loaded"); brunchMenu.Menu_mc.content_mc.menuTxt.styleSheet = sheet; As I am not sure how to attach the stylesheet to my text field once loaded....any help would be grateful! Thanks
  13. Any idea why this line of code here: queue.append( new CSSLoader("xml/styles/styles.css", {name:"myCSS",onProgress:progressHandler}) ); would throw this error? TypeError: Error #1034: Type Coercion failed: cannot convert flash.text::StyleSheet@261fd699 to XML. If I comment this out, it works fine, but I'm trying to get a style sheet loaded into this project. Thanks!
  14. Round 2: Ok so I'm just starting to get into the OOP of as3, but as a designer it's hard for me to wrap my head around some of these concepts. I have a site built out already(which I will go back and reset up as a modleViewController, but for now I just need to get this last aspect of it working. Here is what I have: preloader.fla Preloader.as main.fla Main.as so I have a preloader fla linked up to a preloader.as class, which is using loaderMax to load 2 things, the main.fla(main.swf) and an xml file that has data for the main.swf. I need to make sure the xml data loads first, before the main.swf file, which it does. I am able to trace the xml data when it loads, so I know it's been loaded. Here is where i get lost. So once the main swf is loaded and it's now using the Main.as file to function as a website. How am I able to use the xml var from the preloader.as file for the main.as file. So that I can populate my textFields with data that my Preloader.as file loaded. I hope this makes sense, and if there is any code I need to post just let me know, I tried to explain it, in the most basic way I know how. Thanks
  15. Thanks but that still didn't fix the problem, I can declare the var out side of the function but now do I get the .as file to see that var in my preloader file? So i load the xml and the swf file into the preloader file, and that swf file has an external .as file where i keep all my code, so I just need to know how to link that .as file to my preloader file so they can share vars.
  16. Hello, I would like to start out by saying that I'm a flash designer and not a developer so the questions I have may seem simple. This is the basics of what I'm trying to do. I have a preloader file that I am using loaderMax on, I have fla file that contains all my assests for the site and I have a .as file that I am using to control all of those assets. I have my preloader file loading in the swf file as well as the xml file. This all is working great, as the wf file shows up and works, and I am able to trace the xml file, so I know that works too. What I can't figure out is how to populate my textFields in my .as file with the xml data i loaded from the prelaoder. Here is my preloader code: import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.*; //create a LoaderMax named "mainQueue" and set up onProgress, onComplete and onError listeners var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler}); //append several loaders queue.append( new XMLLoader("xml/testMenus.xml", {name:"myXML", estimatedBytes:1200}) ); queue.append( new SWFLoader("test.swf", {name:"contentClip", estimatedBytes:270000, container:this, visible:true}) ); //start loading queue.load(); //xmlLoader.load(); function progressHandler(event:LoaderEvent):void { trace("progress: " + event.target.progress); } function completeHandler(event:LoaderEvent):void { trace(event.target + " is complete!"); var data_xml:XML = LoaderMax.getContent("myXML"); trace(data_xml); } function errorHandler(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } My as code that doesn't work because it can't fine the data_xml var used in the preloader. brunchMenu.Menu_mc.content_mc.menuTxt.htmlText = String(data_xml.Brunch).replace("\n", ""); Thank you in advance for looking at this.