HomeFAQSubmit TicketFavorites
Search Advanced Search
Categories
Pre-Sale Questions (20)
After Purchase Support (3)
Troubleshooting (7)
Flash Cart E-Commerce (53)
Where Is My Template? (1)
Terms And Conditions (5)
General Flash (6)
Individual Template Support (6)
Donate (1)
Search
Advanced Search
FAQs
Search our FAQ to find resolutions to common issues.
Our Links
Return To Dreamlinestudio
Flash Blog
Flash Templates
Flash Cart
Trouble installing cart as a member of a parent flash SWF???

You may be suffering from some issues trying to add the FlashCart system as a member of a parent swf. There is actually a few ways to remedy this. This article will cover them.

First off you can ONLY load this into a AS3 SWF file. This includes anything compiled in Flex3, Flash CS3 or Flash CS4.

 

##1st choice

1) loading an external SWF and allowing it to self control itself.

First off when loading in the SWF for the cart you actually MUST load Main.swf, not the skin's swf file. The cart's config file will control that part. The thing is that Main.swf depends on a FlashVar given to it through html OR it falls back on a default xml file.

You can either utilize some way to inject a flashVar to the Loader instance telling it where your config.xml file is located.

Or you can have it load the default. The default expected xml file MUST be named "config.xml" and be located adjacent to the embed location. When loading it into a parent the adjacent location would be the same folder Main.swf is located in.

 

##2nd choice

2) loading an external SWF and forcing you own parameter.

Main.swf doesn't start loading until it has been added to the FlashPlayer's stage instance. This means that it doesn't perform any of the work until you either add the Loader instance to your DisplayList OR when you add the "content" of your Loader instance to the DisplayList.

There is a method typed to the Main.swf called "init( url:String ):void", if you run this method BEFORE adding it to any DisplayList you can stop it from parsing out the FlashVar or falling back on the default xml file.

In this case you could load it as follows:

--------CODE-----------

var loader:Loader = new Loader();

loader.contentLoaderInfo.addEventListener( Event.COMPLETE, loadedHandler );

loader.load( new URLRequest("loaction_of_Main.swf") );

function loadedHandler(e:Event):void

{

    loader.content.init( "location_of_config.xml" );

    this.addChild( loader.content );

}

--------END CODE --------------------

 

##3rd choice - ADVANCED USERS ONLY

3) The final solution can be done by instantiating your own instance of the cart system. This method is the most difficult method as it requires a lot of work on your end as a coder, and there are a lot of holes in it.

First off, If you instantiate through class type the config file still must be loaded and passed to the instantiated instance of the cart system. It must still point to the flashCartSystem install directory where dbConfig.php is located.

When instantiating it yourself you must load the "skin" instance on your own, or create your own ISkin class and instantiate it. If you either load a premade skin, or instantiate your own custom one, it must be passed to the cart as an ISkin instance.

Essentially what you'd do is import the "FlashCart" project into  your own project. Load the config.xml file of your choice from wherever, then create an ISkin (either through loading or instantiation), finally create an instance of FlashCart() and run FlashCart.init( configXML, skinInstance )

add the Skin to your DisplayList and you're good to go.

If you look in the Main.as file of the FlashCart project you can see how this is actually what is done by the application. Main.as is merely the access point of the program. It performs a very simple task as described here:

wait to be added to stage OR wait for init() method to fire

figure out location of config XML file and load it in

from the config file figure out the Skin location and load it

instantiate a FlashCart instance

pass it the skin to manage (model-view-control design)

pass the FlashCart system the config file (this lets it know where the install directory of the php is)

Finally add the Skin to the stage.


Print  Email  Save  Comments  Notify Me  Delete from Favorites 
Article ID: 10091 Article Created: 05-27-2009 20:42 PMLast Modified: 05-27-2009 20:42 PM

How well did this article answer your question? 100% 75% 50% 25% 0%

Most Recently Viewed Articles
Enterainer XD Mail List and Email
Configuring the Mailing List and Email...
Can The Main Window Be Enlarged? Flash Menus? Sales Tax?
I will answer this question in 3 parts to separate each question.  ...
AS3 Flashcart Features
AS3 Flashcart Features List...
Can I use both Authorize, 2checkout and Paypal at the same time?
There is no need to use them all....
So XML will not change the color scheme or layout?
XML gives you ability to change the outside functions such as images, text, videos, music....
Where Is My Product(s)?
There are a couple reasons why you may have not seen or received your download link....
Multicart Installation Notes
Multicart Installation Notes...
Do You Have a Starter Or Help Manual?
Yes, we have a general help manual available...
Errors When Exporting Flash Movie
This problem arises because Flash Technology grows very fast, not to mention a new Flash Player seems to come out every week....
Power Player Crashes Program
In the Power Player template - Each time I attempt to publish in Flash Cs3 the app crashes. ...


Web Templates